I have implemented my own test runner with an overridden runChild() method:
public class MyTestRunner extends BlockJUnit4ClassRunner {
// ...
@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
if (method.getAnnotation(Ignore.class) != null) {
return;
}
// Do some global pre-action
// ...
// Runs the passed test case
super.runChild(method, notifier);
// Do some global post-action depending on the success of the test case
// ...
}
// ...
}
I override this method because I need to do some global pre- and post-actions before/after the test case execution. The post-action will be dependent on the failure/success of the test case execution. How can I retrieve the execution result?