I have a project where before every @Test method I do a check to see if the Method's annotation data is valid. If the data isn't valid I want to skip the test method & continue the rest of my test suite.
All the data parsing and logic works fine, but from what I can tell I am using the wrong tool for the job.
My code has...
private SoftAssert s_assert = new SoftAssert(); @BeforeMethod public void beforeMethod(Method m){ //reads code if (dataNotCorrect) s_assert.fail(); } @Test @MyCustomAnnotation(data = incorrect) public void Test1(){ //Do stuff } @Test @MyCustomAnnotation(data = correct) public void Test2(){ //Do stuff } In this scenario I want to start trying to do both, but when the test runs Test1() should be skipped and testng should continue on to run Test2(). Yet as soon as I catch the fail at Test1(), it ends the whole suite at Test1(). Skipping not only Test1() but also Test2().
I've tried both with a Soft assert and normal assert but neither seem to work.