Hello all, I have been trying to get JUnitBenchmarks running but am not getting the results I expect. The original test is an existing junit test using the @Test annotation. Following the instructions added the following to the test:
@Rule
public TestRule benchmarkRun = new BenchmarkRule();
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 0)
The test compiles fine, no warnings or obvious issues. However, when i run the test (in eclipse) the test still only executes one time. There is no JUnitBenchmarks output in the console. To illustrate I have a modified, very simple, test as follows:
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import com.carrotsearch.junitbenchmarks.BenchmarkOptions;
import com.carrotsearch.junitbenchmarks.BenchmarkRule;
public class NotificationPerformanceTester {
@Rule
public TestRule benchmarkRun = new BenchmarkRule();
@BenchmarkOptions(benchmarkRounds = 20, warmupRounds = 0)
@Test
public void sendNotify() throws Exception{
System.out.println("**** Running ****");
Thread.sleep(1000);
}
}
Since I have set the number of rounds to 20 I would expect to see "**** Running ****" printed in the console 20 times and i am expecting to see some performance statistics from JUnitBenchmarks. When I run the test I only see the expected text printed once, no JUnitBenchmarks output and the test time is around 1.005 s. I imagine I am missing something simple but I'm not sure what that is, does anyone see something that I am missing?
Regards.