Remove try-catch from Test classes (#798)
* Updating the Selenium version * Remove try-catch from Test classes * Making changes in Maven Profile for Test Case Failure * Making changes in Maven Profile for Test Case Failure
This commit is contained in:
commit
a6019567a0
@ -25,6 +25,7 @@
|
|||||||
<include>**/*UnitTest.java</include>
|
<include>**/*UnitTest.java</include>
|
||||||
</includes>
|
</includes>
|
||||||
<systemPropertyVariables></systemPropertyVariables>
|
<systemPropertyVariables></systemPropertyVariables>
|
||||||
|
<testFailureIgnore>false</testFailureIgnore>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
@ -42,6 +43,7 @@
|
|||||||
<includes>
|
<includes>
|
||||||
<include>**/*LiveTest.java</include>
|
<include>**/*LiveTest.java</include>
|
||||||
</includes>
|
</includes>
|
||||||
|
<testFailureIgnore>false</testFailureIgnore>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
@ -56,6 +56,6 @@ public class SeleniumExample {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuthorInformationAvailable() {
|
public boolean isAuthorInformationAvailable() {
|
||||||
return webDriver.findElement(By.xpath("//*[contains(text(), 'Eugen – an engineer')]")).isDisplayed();
|
return webDriver.findElement(By.xpath("//*[contains(text(), 'an engineer with a passion for teaching and building stuff on the web')]")).isDisplayed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,16 +26,11 @@ public class SeleniumWithJUnitLiveTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenAboutBaeldungIsLoaded_thenAboutEugenIsMentionedOnPage() {
|
public void whenAboutBaeldungIsLoaded_thenAboutEugenIsMentionedOnPage() {
|
||||||
try {
|
|
||||||
seleniumExample.getAboutBaeldungPage();
|
seleniumExample.getAboutBaeldungPage();
|
||||||
String actualTitle = seleniumExample.getTitle();
|
String actualTitle = seleniumExample.getTitle();
|
||||||
assertNotNull(actualTitle);
|
assertNotNull(actualTitle);
|
||||||
assertEquals(actualTitle, expecteTilteAboutBaeldungPage);
|
assertEquals(actualTitle, expecteTilteAboutBaeldungPage);
|
||||||
assertTrue(seleniumExample.isAuthorInformationAvailable());
|
assertTrue(seleniumExample.isAuthorInformationAvailable());
|
||||||
} catch (Exception exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
seleniumExample.closeWindow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,15 +26,10 @@ public class SeleniumWithTestNGLiveTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenAboutBaeldungIsLoaded_thenAboutEugenIsMentionedOnPage() {
|
public void whenAboutBaeldungIsLoaded_thenAboutEugenIsMentionedOnPage() {
|
||||||
try {
|
|
||||||
seleniumExample.getAboutBaeldungPage();
|
seleniumExample.getAboutBaeldungPage();
|
||||||
String actualTitle = seleniumExample.getTitle();
|
String actualTitle = seleniumExample.getTitle();
|
||||||
assertNotNull(actualTitle);
|
assertNotNull(actualTitle);
|
||||||
assertEquals(actualTitle, expecteTilteAboutBaeldungPage);
|
assertEquals(actualTitle, expecteTilteAboutBaeldungPage);
|
||||||
assertTrue(seleniumExample.isAuthorInformationAvailable());
|
assertTrue(seleniumExample.isAuthorInformationAvailable());
|
||||||
} catch (Exception exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
seleniumExample.closeWindow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user