对于性能测试,我正在尝试将 Contiperf http://databene.org/contiperf与我的 JUnit 测试用例一起使用
使用独立的测试类 contiperf 正在工作。
但是当我将 Contiperf 与现有的通过测试用例一起使用时,它不起作用。
import org.databene.contiperf.junit.ContiPerfRule;
import org.databene.contiperf.junit.ContiPerfSuiteRunner;
import org.junit.Rule;
public class TU_XSL_OrderDlt extends TranslatorUtls {
@Rule
public ContiPerfRule i = new ContiPerfRule();
@Test
@PerfTest(invocations = 1, threads = 1)
public void testNormalTranslation() throws Exception {
assertTranslation("testdata/OrderDeltInput.xml", "testdata/OrderDltOutput.xml");
}
}
以下异常我得到:
java.lang.RuntimeException: java.lang.NoSuchFieldException: fNext
at org.databene.contiperf.junit.ContiPerfRule.apply(ContiPerfRule.java:176)
at org.junit.runners.BlockJUnit4ClassRunner.withMethodRules(BlockJUnit4ClassRunner.java:365)
at org.junit.runners.BlockJUnit4ClassRunner.withRules(BlockJUnit4ClassRunner.java:355)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:278)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.NoSuchFieldException: fNext
at java.lang.Class.getDeclaredField(Class.java:2070)
at org.databene.contiperf.junit.ContiPerfRule.apply(ContiPerfRule.java:166)
... 17 more