Using the JUnit assumeTrue, you can skip a test, but is there any way to tell JUnit that the test has been skipped? It seems to just report that the test has passed….
Also, is there any way to detect during the @After method, if any tests have failed?
E.g.
@After
public void tearDown() {
//.... How many tests passed and how many failed?
}
I know this information is reported at the end of all the tests, but I would like to be able to access it in the @After function.
You can implement your own Test Runner:
@See: org.junit.runners.BlockJUnit4ClassRunner
Or you can have a look at TestDecorators (in JUnit 4.7) junit.extensions.TestDecorator. That sounds like the thing you need, but I have no expirance with.