オーバーライドされた runChild() メソッドを使用して、独自のテスト ランナーを実装しました。
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
// ...
}
// ...
}
テスト ケースの実行前後にグローバルな事前アクションと事後アクションを実行する必要があるため、このメソッドをオーバーライドします。事後アクションは、テスト ケース実行の失敗/成功に依存します。実行結果を取得するにはどうすればよいですか?