0 votes
1 view
in DevOps and Agile by (19.8k points)

The checks selenium performs usually come in two flavours: assertFoo() and verifyFoo(). I understand that assertFoo() fails the whole test case whereas verifyFoo() just notes the failure of that check and lets the test case carry on.

So with verifyFoo() method, I can get test results for multiple conditions even if one of them fails. On the other hand, one failing check for me is enough to know, that my edits broke the code and I have to correct them anyway.

So my question is:
In which concrete situations do you prefer one of the two ways of checking over the other? What are your experiences that motivate your view?

1 Answer

0 votes
by (63.4k points)

I would use an assert() as an entry point (a "gateway") into the test. Only if the assertion passes, will the verify() checks be executed. For instance, if I'm checking the contents of a window resulting from a series of actions, I would use assert() method to check the presence of the window, and then verify() the contents.

An example I usually use- checking the estimates in a jqgrid: assert() the presence of the grid, and verify() the estimates

Welcome to Intellipaat Community. Get your technical queries answered by top developers !