Issue
I created a TestWatcher
which should do something when a TestCase
fails
, succeeded
or is skipped
.
The Methods
succeeded
and failed
are fired, but neither
@Override
protected void skipped(AssumptionViolatedException e, Description description) {
System.out.println("Skipped: " + description);
e.printStackTrace();
}
nor
@Override
protected void skipped(org.junit.internal.AssumptionViolatedException e, Description description)
{
System.out.println("Skippedinternal: " + description);
e.printStackTrace();
}
are fired.
Why aren't those two called when a test
is ignored
or is this the wrong way to react to an ignored test
and if that's the case how can i accomplish that?
Solution
The skipped event in TestWatcher (http://junit.org/junit4/javadoc/4.12/org/junit/rules/TestWatcher.html) is triggered only in case the test is skipped due to failed assumption (http://junit.sourceforge.net/javadoc/org/junit/Assume.html).
Answered By - jperala