How to perform Negative Testing?
Ans:
Objectives:
Failure Message will be shown.
Problems/
Issues:
·
Implementation is not done properly.
·
Success message is shown on that specific case.
Solution/
Checking procedure:
·
On that case, first check the success message
has shown or not. If success message is shown, then the failure message is not
exists.
Code:
Part1:
public boolean
checkFileBigSizeAlertExists() throws
NumberFormatException, IOException {
try {
waitForElement(successMsgOfEmpUpdate, Integer.valueOf(PropertyLoader.loadProperty("implicit_timeout_sec_120")));
if (driverW.findElement(By.cssSelector(".page-con.page-con-ajax
.alert.alert-success")) != null) {
return false;
}
else {
return true;
}
} catch
(NoSuchElementException e) {
return true;
}
}
Part2:
boolean
bigSizeAlertExists = employeesPage.checkFileBigSizeAlertExists();
Assert.assertEquals(bigSizeAlertExists,
true, "Profile picture with extra size
succuessfully uploaded");
No comments:
Post a Comment