Running benchmarks with groovy classes

Aaron Tull atull at netflix.com
Tue Feb 18 13:17:47 PST 2014


I'm hoping someone can help me answer this question. I am testing an API
written to be used on the dynamic jvm languages like groovy. So my tests
look something like this:

// in BenchmarkTest.java
@State(Scope.Benchmark)
public class BenchmarkTest {

    private MyBench bench;

    @Setup
    public void setup() {
        bench = new MyBench(ext);
    }

    @TearDown
    public void tearDown() {
        bench = null;
    }

    @GenerateMicroBenchmark
    public void runBase() {
        bench.runBase();
    }

    @GenerateMicroBenchmark
    public void runExp() {
        bench.runExp();
    }
}

// in MyBench.groovy
class MyBench {

    public void runBase() {
        // test code here
    }


    public void runExp() {
        // test code here
    }

}

When I run this as a benchmark I get compilation errors "error: cannot find
symbol" MyBench. I have this project setup properly in gradle to use the
groovy compiler. Has anyone seen problems like this before or have a work
around?


Aaron


More information about the jmh-dev mailing list