Interview Questions

How to do negative testing on webpage ? Can I have to capture all error pages ?

SilkTest Questions and Anwsers


(Continued from previous question...)

82. How to do negative testing on webpage ? Can I have to capture all error pages ?

Capturing all the error messages page would lengthen your script.....Capture only one page and using "*" in declaration try to make the identifier common to all the pages...
If the error message appears as a text message, get the index of the text (Generally it is fixed) and retrieve the value of the test and compare with the expected e,g

if BrowserPage.HtmlText ("#1").GetText () == "Invalid date"
Print ("Pass")
else
Print ("Fail")


Suppose first time you enter an invalid mail ID and the error page has the tag "Error Page - Invalid mail ID". 2nd time you enter invalid date and the error page has the tag "Error Page - Invalid date".
To generalize the error page, change the tag to "Error Page - Invalid*" or "Error Page*" which suffices that error page is there.....

(Continued on next question...)

Other Interview Questions