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. The test execution will continue with the next step after the assert statement.
If we use normal asserts like Assert.assertTrue()
or Assert.assertEquals()
in TestNG, @Test
Method will immediately fail after any of the Asserts fails.