有没有办法在 JUnit 测试套件中放置简单的开始/停止计时?
当我创建一个测试套件类时,它看起来像这样,我可以运行它。但是我怎么能在这里放一个简单的长开始时间变量来显示所有测试运行了多长时间?
public class AllTests {
public static Test suite() throws Exception {
TestSuite theTestSuite = new TestSuite();
theTestSuite.addTest(com.company.AllBlahTests.suite());
theTestSuite.addTest(com.company.AllOtherTests.suite());
return theTestSuite;
}
}
最佳答案
请参阅上一个问题的答案。 Before and After Suite execution hook in jUnit 4.x
如果您实现该解决方案,您可以将计时代码放在套件类的设置和拆卸方法中。
关于java - 基准 JUnit AllTests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15572806/