I have a custom listener which sets some global flag when any test fails:
public class MyListener extends TestListenerAdapter
public void onTestFailure(ITestResult tr)
GlobalFlag.failureStatus = true;
Then, I have a MyHookable which checks if that flag is set. If set, just print to skip else call the method.
public class MyHookable implements IHookable
public void run(IHookCallBack icb, ITestResult testResult)
//if previous tests pased , allow next tests to run
if(GlobalFlag.failureStatus == false)
//don't allow any more tests to run
System.out.println("Skipping test execution for "+testResult.getTestName());
I created 3 tests(Test1, Test2, Test3) and I made all the tests to fail with
when I am executing these tests, I see that it's always coming in else block after executing Test1 and printing that test2 and test3 is getting skipped but, in the result at the end , it says
Test2 Passed(despite Assertion failure)
Test3 Passed. (despite Assertion failure)
It looks like reporter doesn't know if the test being skipped by IHookable.