To “assert” or to “verify”
is a decision that a tester has to take depending on the strategy followed for
testing. There is no point in checking
the text on the page if the page itself has not loaded successfully. If you are
not on the expected page, you may want to abort the test and look for a root
cause and fix the issue promptly. Or, you may want to run through the test
suite and list all the issues on the page and then fix them all together. Effectively, an “assert” will fail the test
and abort the current test case, whereas a “verify” will fail the test and
continue to run the test case.
However the best use is to group the commands logically
by using “assert” first, followed by “verify”.
Below is an example
Command
|
Target
|
value
|
open
|
/login
|
|
assertTitle
|
Login
|
|
verifyText
|
//h1
|
Login
|
In the above example , first the “login” page is opened,
and then “asserts” that correct page is loaded with title “Login”. Once confirmed,
we can check the page has text “Login” in expected position
No comments:
Post a Comment