Refactor Selenium tests
This commit is contained in:
parent
2c99d93c3f
commit
373f336b81
|
@ -1,18 +1,16 @@
|
||||||
package test.java.com.baeldung.selenium.junit;
|
package test.java.com.baeldung.selenium.junit;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
import static org.testng.Assert.assertNotNull;
|
|
||||||
import static org.testng.Assert.assertTrue;
|
|
||||||
import main.java.com.baeldung.selenium.SeleniumExample;
|
import main.java.com.baeldung.selenium.SeleniumExample;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
public class SeleniumWithJUnitLiveTest {
|
public class SeleniumWithJUnitLiveTest {
|
||||||
|
|
||||||
private static SeleniumExample seleniumExample;
|
private static SeleniumExample seleniumExample;
|
||||||
private String expecteTilteAboutBaeldungPage = "About Baeldung | Baeldung";
|
private String expectedTitle = "About Baeldung | Baeldung";
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUp() {
|
public static void setUp() {
|
||||||
|
@ -29,7 +27,7 @@ public class SeleniumWithJUnitLiveTest {
|
||||||
seleniumExample.getAboutBaeldungPage();
|
seleniumExample.getAboutBaeldungPage();
|
||||||
String actualTitle = seleniumExample.getTitle();
|
String actualTitle = seleniumExample.getTitle();
|
||||||
assertNotNull(actualTitle);
|
assertNotNull(actualTitle);
|
||||||
assertEquals(expecteTilteAboutBaeldungPage, actualTitle);
|
assertEquals(expectedTitle, actualTitle);
|
||||||
assertTrue(seleniumExample.isAuthorInformationAvailable());
|
assertTrue(seleniumExample.isAuthorInformationAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
package test.java.com.baeldung.selenium.testng;
|
package test.java.com.baeldung.selenium.testng;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
import static org.testng.Assert.assertNotNull;
|
|
||||||
import static org.testng.Assert.assertTrue;
|
|
||||||
import main.java.com.baeldung.selenium.SeleniumExample;
|
import main.java.com.baeldung.selenium.SeleniumExample;
|
||||||
|
|
||||||
import org.testng.annotations.AfterSuite;
|
import org.testng.annotations.AfterSuite;
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
public class SeleniumWithTestNGLiveTest {
|
public class SeleniumWithTestNGLiveTest {
|
||||||
|
|
||||||
private SeleniumExample seleniumExample;
|
private SeleniumExample seleniumExample;
|
||||||
private String expecteTilteAboutBaeldungPage = "About Baeldung | Baeldung";
|
private String expectedTitle = "About Baeldung | Baeldung";
|
||||||
|
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
@ -29,7 +27,7 @@ public class SeleniumWithTestNGLiveTest {
|
||||||
seleniumExample.getAboutBaeldungPage();
|
seleniumExample.getAboutBaeldungPage();
|
||||||
String actualTitle = seleniumExample.getTitle();
|
String actualTitle = seleniumExample.getTitle();
|
||||||
assertNotNull(actualTitle);
|
assertNotNull(actualTitle);
|
||||||
assertEquals(expecteTilteAboutBaeldungPage, actualTitle);
|
assertEquals(expectedTitle, actualTitle);
|
||||||
assertTrue(seleniumExample.isAuthorInformationAvailable());
|
assertTrue(seleniumExample.isAuthorInformationAvailable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue