Arjun Dev
Arjun Dev

Reputation: 414

Difference between Soft Assert And Verify

Is there any difference between Soft assert and Verify?

I am well aware that Verify is implemented using SoftAssert class. And when any of the methods fails, both the above keywords will continue the execution.

Is there a specific difference while using soft assert and verify in TestNG framework?

Upvotes: 6

Views: 4220

Answers (2)

Ranjith Babu K
Ranjith Babu K

Reputation: 1

SoftAsserts - If there is a failure it proceeds after the check but in order to obtain all the failures we need to use obj.assertAll() at the end of the execution.

Verify - It is implemented using the SoftAssert class. If there is a failure it fails the test and then proceeds and we don't need to add an additional command or code to get all failures at the end of execution.

Upvotes: 0

Purendra Agrawal
Purendra Agrawal

Reputation: 558

If we are talking about functionality then there is no such difference. But I would suggest you using "soft assert" instead of "verify" because it gives you better visibility in terms of coding and reporting.

Upvotes: 2

Related Questions