Skip to content
CodeKruPro

A soft assertion fails in the middle of a TestNG test

QuizEasy-MediumJava onlyAsked in: Accenture, Capgemini, Wipro

A TestNG test creates SoftAssert soft = new SoftAssert();. A soft.assertEquals(...) check on line 3 fails. The last line of the test is soft.assertAll();. What happens?

  • The test keeps running; at assertAll() it fails and reports every soft failure
  • The test stops at line 3
  • The failure is ignored and the test passes
  • The test is marked skipped

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in