limited time offer

What is soft assertion in Selenium? How can you mark a test case as failed by using soft assertion?

Soft Assertions are customized error handlers provided by TestNG. Soft Assertions do not throw exceptions when assertion fails, and they simply continue to the next test step. They are commonly used when we want to perform multiple assertions.

To mark a test as failed with soft assertions, call assertAll() method at the end of the test.

public void myTest() 
    SoftAssert softAssert = new SoftAssert();