Is there a way to get hold of Result.roundAverage programatically?

66 views
Skip to first unread message

John Taylor

unread,
Sep 4, 2014, 9:23:24 PM9/4/14
to junit-be...@googlegroups.com
I'm trying to find a way to fail a test if the current Result.roundAverage value is a lot slower than the best historical value.

At the moment I am querying the H2 database in the @AfterClass method but this isn't working as the current value hasn't been written to the database yet.  (It looks like a different thread is writing to the database)

Is there a way to get the value of Result.roundAverage through the API?  If not, could I wire up my own IResultsConsumer somehow?

Dawid Weiss

unread,
Sep 5, 2014, 6:00:15 AM9/5/14
to junit-benchmarks
> Is there a way to get the value of Result.roundAverage through the API? If
> not, could I wire up my own IResultsConsumer somehow?

You can use your own IResultsConsumer, but I would rather run any such
checks as part of a separate build step than the application itself.

An example of using a consumer explicitly is here (you can either
decorate/ delegate or provide multiple consumers to the
BenchmarkRule).

https://github.com/carrotsearch/junit-benchmarks/blob/master/src/test/java/com/carrotsearch/junitbenchmarks/examples/ArrayListIterationBenchmark.java#L25

Dawid
Reply all
Reply to author
Forward
0 new messages