How to Fail Setup and Teardown in TestNG
TrainingLace路3 months agoTo purposefully fail setup in TestNG, you can just throw an exception in your @BeforeMethod or @BeforeClass annotated method. For teardown, do the same in @AfterMethod or @AfterClass.
Win gift cards by playing fun games on Playbite!
Playbite
500k winners and counting...
More Answers
Just throw an exception in your setup or teardown methods... easy peasy, lemon squeezy!
Throwing a RuntimeException in your setup or teardown methods will do the trick. :D
Experience talking here: if you want your tests to fail setup or teardown, literally just slap in a `throw new RuntimeException();` where you want it to crash.
馃憖 If you like Teardown...
Diego路3 hours agoThe brands referenced on this page are not sponsors of the rewards or otherwise affiliated with this company. The logos and other identifying marks attached are trademarks of and owned by each represented company and/or its affiliates. Please visit each company's website for additional terms and conditions.
People also want to know
Add an Answer