Merge branch 'master' of github.com:Sandeep4odesk/tutorials

This commit is contained in:
Sandeep Kumar 2016-09-19 21:27:10 +05:30
commit fe59ea2923
2 changed files with 68 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}