Sunday, November 27, 2016

Validating conditions using assert and verify in Selenium IDE

The purpose of any automation/manual tests is to validate the application is working correctly and validating the actual outcome with the expected outcome for a condition.


  • Now the first question arises, what are the commands in selenium IDE which validates the outcome of condition There are different commands in different tools/automated suite. In selenium IDE, we can use assert or verify commands to validate the results.
  • Now the question two arises, what is the difference between assert and verify commands, When we use Assert command, it checks whether the given condition is true or false and stops further test execution if the assert statement fails. In case of verify command, in case the execution fails, the execution moves to next step in the test although the test is marked as failed.
  • Now coming to question three, when to use verify or assert command. In case of critical condition failing and no point to continue with test, use assert command. In case of minor condition failing in the test and we still wants to continue with further steps in the test, we can use verify statement.
  • So what is the next logical question in mind, when and how  to add the validation steps in test.Since Selenium IDE is a record and play tool,
    • Record execution flow. Once execution flow is recorded, we can add assertions in Selenium IDE.
    • Just right click the element on which the condition needs to be verified in Firefox browser e.g : Validating the text of the link. 
    • Click on the assertion to be added as shown below:

Add assertions selenium IDE


Similar to assert/verify commands in selenium IDE, we can use assert and soft.assert class for assert and verify command in Selenium Webdriver.

1 comment:

  1. Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks; from every one of us.

    selenium training in bangalore|

    ReplyDelete