What Is The Difference Between Assert And Verify In Selenium

February 17, 2013

Here is a small effort to understand the difference between to technologies of selenium called..

  • Assert*
  • Verify* 

Assert* will fail the test if something is missing and execution will stop thereVerify* will report the missing item at last without stopping the execution
One can easily understand what went wrong during executionOne has to go through result files or log to understand why it got failed
Live visual display of errorTest engineer has to follow the script or result file to create such environment
Mostly used in debug mode,This can be used in releases or in production to make sure everything is ok and will not affect other userMostly used in test automation execution during release,UAT
Test coverage becomes lesserTest coverage is higher
When an assert fails the test is immediately abortedwhen a verify fails the test will continue till end
Example of Asset Statement:
                                Assert.IsFalse(selenium.IsTextPresent("Ask QTP")); 
                        catch (AssertionException e) 

Example of Verify Statement:
verifyEquals(selenium.getText("arg1"), "arg2"); 
Hope you like this post . Please let me know about thought on this. Please post your comment below.

You Might Also Like