SoftAssert in TestNG example
Submitted by harrydev on Sun, 11/18/2018 - 00:44SoftAssert in TestNG helps to collect all the assertions throughout the @Test
method. And to see assertions result at the end of the test, we have to invoke assertAll()
.
SoftAssert don't throw an exception when an assert fails, but it records the failure. The test execution will continue with the next step after the assert statement. Calling assertAll()
will cause an exception to be thrown if at least one assertion failed.