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.
Similar to assert/verify commands in selenium IDE, we can use assert and soft.assert class for assert and verify command in Selenium Webdriver.
- 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:
- 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:
Similar to assert/verify commands in selenium IDE, we can use assert and soft.assert class for assert and verify command in Selenium Webdriver.