While creating Tests, sometimes it doesn't give the exact results that we intended. Test Automation is no different from any other tasks involving Computing systems. Computers do the task we directed them to do and not the task we wanted it to do.


Let us look at a scenario where one of the Test Cases you created didn't work as expected or showed a result different from what you expected.

For example, let's say you create a Test Case to test the login feature.

1. Go to URL

2. Enter username in username field

3. Enter password in password field

4. Click on Login button


In this case, the test would pass even if the login didn't work. The reason is that it performed successfully all the steps it was told to. It clicked on the Login button successfully. You never told it to verify that the login worked.


If you need it to fail, you need to add a verification step to verify that a new page was loaded or a new element was added to the page post login. Something like this:
1. Go to URL

2. Enter username in username field

3. Enter password in password field

4. Click on Login button

5. Verify that the element Dashboard is present on the page