Reputation: 81
For performance testing, I am trying to use Contiperf http://databene.org/contiperf with my JUnit testcases
With independent test class contiperf is working.
but when I using Contiperf with my existing passing test case, its not working.
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");
}
}
Following exception I get:
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
Upvotes: 3
Views: 767
Reputation: 4477
JUnit 4.12 applies that field renaming, the PR to fix it was sent a long time ago.
I suggest you use version 2.4.3 that has the change and is already on maven central.
Please note that the dependency group has changed, but other than changing the imports the code should remain the same.
Upvotes: 1