3

Can someone explain what the difference between assert and verify is please.

I know that verify means it checks if it is there, if it isn't the test fails and stops there (correct?).

So does assert carry on even if it does fail?

I've read the documentation and still can't get my head round it.

orange
  • 5,297
  • 12
  • 50
  • 71

1 Answers1

5

Nope, you've got it backwards. In Selenium IDE, both verifyWhatever and assertWhatever commands determine if the specified condition is true, and then different things happen. The assertWhatever command fails the test immediately if the condition is false. The verifywhatever command allows the test to continue, but will cause it to fail when it ends. Thus, if your test requires you to check for the presence of several items, none of which are present, assertElementPresent will fail on the first, while verifyElementPresent will fail reporting that all are missing.

The down side to verifyWhatever is that you really can't trust the behavior of any test after one of its verifications fails. Since the application isn't responding correctly, you have no way of knowing whether subsequent assertion or verification failures are valid or are the result of the earlier failures. Thus some of us think verifyWhatever commands are Evil.

Ross Patterson
  • 9,527
  • 33
  • 48
  • Note that this is true for e.g. `verifyElementPresent` but not true for `verifyText`. If the latter is false, selenium fails the test immediately. – Dennis Golomazov Jul 24 '13 at 14:02