Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Soft Assert And Verify

Tags:

testng

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?

like image 553
Arjun Dev Avatar asked May 13 '19 12:05

Arjun Dev


People also ask

What is difference between assert and verify command?

Assert: If the assert condition is true then the program control will execute the next test step but if the condition is false, the execution will stop and further test step will not be executed. whereas, Verify: There won't be any halt in the test execution even though the verify condition is true or false.

Why do we use soft assert?

Soft asserts are the asserts which continue the execution even after the Assert condition fails. Soft asserts are mainly used to verify certain test conditions in the code. It is used in a case when the passing of one test condition is not necessary to execute the upcoming tests.

What is soft assert?

Soft Assertions are the type of assertions that do not throw an exception immediately when an assertion fails. Therefore, all steps and soft assertions in the automated test will execute before failing the test.

Where do we use verify selenium?

Verify is a class, used for comparing expected and actual test results as assert class does, but when it fails it will not stop the test execution, it continues to run the test cases. In Selenium Web Driver it is achieved using Soft Assertion.


1 Answers

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.

like image 91
Purendra Agrawal Avatar answered Oct 16 '22 10:10

Purendra Agrawal