0
我想在所有的junit测试和之后的一个方法之前运行一个方法。以下链接很好地解释了如何实现RunListener,但我不明白为什么tetRunStarted方法没有被调用。这是我想使用RunListener的主要原因,但testRunFinished方法正常工作。JUnit testRunStarted方法不叫
我想在所有的junit测试和之后的一个方法之前运行一个方法。以下链接很好地解释了如何实现RunListener,但我不明白为什么tetRunStarted方法没有被调用。这是我想使用RunListener的主要原因,但testRunFinished方法正常工作。JUnit testRunStarted方法不叫
在MyRunner类的明确通知应补充:
public class MyRunner extends BlockJUnit4ClassRunner {
...
@Override
public void run(RunNotifier notifier) {
notifier.addListener(new JtmRunListener());
notifier.fireTestRunStarted(getDescription());
super.run(notifier);
}
...
}