我已经成功地在 ContiPerf 2 上开发了一个玩具单元测试。当我尝试在 Arquillian 单元测试上做同样的事情时,ContiPerf 注释@PerfTest
似乎不起作用,而注释却@Required
很好。我的测试课看起来像
@RunWith(Arquillian.class)
public class PerformanceFacadeBeanTest {
@Rule
public ContiPerfRule i = new ContiPerfRule();
@EJB
private PerformanceFacadeRemote performanceRemote;
@Deployment
public static Archive<EnterpriseArchive> createArchive() {
...
}
@Test
@InSequence(value=1)
@PerfTest(invocations = 100, threads = 5)
@Required(max = 1200, average = 250)
public void testPerformanceOnCacheLocal() {
testPerformanceOnCache(performanceLocal);
}
private void testPerformanceOnCache(PerformanceFacade performanceFacade) {
performanceFacade.performOnCache();
}
}
我得到的例外是
org.databene.contiperf.PerfTestExecutionError: org.junit.internal.runners.model.MultipleFailureException: There were 2 errors:
java.lang.NullPointerException(null)
java.lang.NullPointerException(null)
at org.databene.contiperf.util.ContiPerfUtil.executionError(ContiPerfUtil.java:66)
at org.databene.contiperf.junit.JUnitInvoker.invoke(JUnitInvoker.java:54)
at org.databene.contiperf.util.InvokerProxy.invoke(InvokerProxy.java:46)
at org.databene.contiperf.PerformanceTracker.invoke(PerformanceTracker.java:97)
at org.databene.contiperf.CountRunner.run(CountRunner.java:52)
at java.lang.Thread.run(Thread.java:722)
有什么想法吗?如果需要,我可以发布我的 pom.xml。