Skip to end of metadata
Go to start of metadata

The performance extension to Arquillian is a simple way of checking that the code you want to test performs within the range you want it to. It can also automatically catch any performance regressions that might be added to your applications and as Arquillian itself, it is very easy to use.

Code example:

As you can see the only two additions needed are @Performance and @PerformanceTest. They do different things and can be used separately or combined.

@Performance requires one argument, time (a double) which sets the required maximum time in milliseconds that the test is allowed to spend. If the test exceeds that time it will fail with an exception explaining the cause.

@PerformanceTest will cause every test run of that test to be saved and every new run will compare results with previous runs. If the new test run exceeds the previous runs with a defined threshold an exception will be thrown. The threshold can be set with the parameter resultsThreshold. It is by default set to 1d.

How threshold is calculated: resultsThreshold * newTime < oldTime.

Maven setup example:

The only extra dependency needed is to add arquillian-performance to your pom.xml. Take a look at the Getting started to see how you set up arquillian using maven.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Nov 05, 2012

    Could we get the actual duration somehow? Perhaps by adding that to JUnit result xml or such.

    IIRC I filed a jira but can't find now.

  2. Mar 31, 2016

    You wrote: "How threshold is calculated: resultsThreshold * newTime < oldTime."

    But i think it has to be: resultsThreshold * oldTime < newTime.