I'm currently trying to write inside a log file the total number of failed tests from a JUnite Suite.
My testsuite is defined as follows:
@RunWith(Suite.class)
@SuiteClasses({Class1.class, Class2.class etc.})
public class SimpleTestSuite {}
I tried to define a rule which would increase the total number of errors when a test fails, but apparently my rule is never called.
@Rule
public MethodRule logWatchRule = new TestWatchman() {
public void failed(Throwable e, FrameworkMethod method) {
errors += 1;
}
public void succeeded(FrameworkMethod method) {
}
};
Any ideas on what I should to do to achieve this behaviour?