Merge branch 'master' of github.com:Sandeep4odesk/tutorials
This commit is contained in:
commit
fe59ea2923
|
@ -0,0 +1,34 @@
|
||||||
|
package com.baeldun.selenium.testng;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||||
|
import org.testng.annotations.AfterSuite;
|
||||||
|
import org.testng.annotations.BeforeSuite;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
public class TestSeleniumWithTestNG {
|
||||||
|
|
||||||
|
private WebDriver webDriver;
|
||||||
|
private final String url = "http://www.baeldung.com/";
|
||||||
|
private final String expectedTitle = "Baeldung | Java, Spring and Web Development tutorials";
|
||||||
|
|
||||||
|
@BeforeSuite
|
||||||
|
public void setUp() {
|
||||||
|
webDriver = new FirefoxDriver();
|
||||||
|
webDriver.get(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterSuite
|
||||||
|
public void tearDown() {
|
||||||
|
webDriver.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenPageIsLoaded_thenTitleIsAsPerExpectation() {
|
||||||
|
String actualTitleReturned = webDriver.getTitle();
|
||||||
|
assertNotNull(actualTitleReturned);
|
||||||
|
assertEquals(expectedTitle, actualTitleReturned);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.baeldung.selenium.junit;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||||
|
|
||||||
|
public class TestSeleniumWithJUnit {
|
||||||
|
|
||||||
|
private WebDriver webDriver;
|
||||||
|
private final String url = "http://www.baeldung.com/";
|
||||||
|
private final String expectedTitle = "Baeldung | Java, Spring and Web Development tutorials";
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
webDriver = new FirefoxDriver();
|
||||||
|
webDriver.get(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
webDriver.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenPageIsLoaded_thenTitleIsAsPerExpectation() {
|
||||||
|
String actualTitleReturned = webDriver.getTitle();
|
||||||
|
assertNotNull(actualTitleReturned);
|
||||||
|
assertEquals(expectedTitle, actualTitleReturned);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue