ISTQB Certified Software Test Engineer

Wednesday, November 17, 2010

Difefrence between Verify and Assert in Selenium

In selenium while using IDE or RC we will find two methods for

1.Verification
2.Assertion

We know that both are used to find whether a given text(input) was present or not in the loaded(opened)webpage,but why there are two methods defined when they are behaving in a same manner??

There is a difference between these two methods

When we are executing a testcase of 10 lines(assume a testscript of 10 lines in which we used both verify (4line)and assert(6 line)),When Verify text failed(means the input text was not there in the loaded page) it gives the test result as failed but all the steps after this Verify statement were executed till the end of the scrpit.

Coming to Assert if assertion failed, testcase aborted from that line and will stop executing the remaining statements in the script

:)

2 comments: