Saturday, October 6, 2012

0 Difference between verification and assertion

There are various commands for Verification and Assertion in Selenium IDE. We had discussed few of them in Selenese Commands.

The prime difference between these commands is that,

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. For example: After clicking on Selenium IDE tab on questionselenium.com , I do an assertion to check if it has opened the right page. If assertion failed then there is no point proceeding with rest of the test case that performs testing on Selenium IDE page.

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

0 comments:

Post a Comment

 

QuestionSelenium Copyright @Shiva Krishna