Wednesday 30 April 2014

Difference Between Assert and Verify

Verify command will not stop execution of test case if verification fails. It will log an error and proceed with execution of rest of the test case. We use verify commands in Selenium IDE when we still want to proceed with execution of test case even if expected output if not matched for a test step.

For example: After clicking on Selenium IDE tab on questionselenium.com , I'll do a verification to check if it showing Table of contents with all entries. If verification failed then I could still test rest of the elements under Selenium IDE page by logging in a verification failure for test step that checks Table of contents.

Assert command will stop execution of test case if verification fails. It will log an error and will not proceed with execution of rest of the test case. We use assertions in scenarios where there is no point proceeding further if expected output is not matched.



Its pretty simple.
  • Use assertions when you want to stop execution of a test case if expected output is not matched 
  • Use verification when you still want to proceed execution of a test case if expected output is not matched.