Jmeter functions by executing performancetests based on .jmx files specifying the tests. The output of the testexecution will be a .jtl file (in an xml like format), which may either be analyzed by jmeter itself, or parsed by an external tool.These are normally created in the JMeter user interface.
This goal helps with the execution of the performancetests. It will typically be invoked as part of a nightly build, since the performancetests probably will be too painful to execute as part of every build.
The testcases can be requests for an external resource (http) or JUnit testcases. To that purpose, the classpath of the current project/module is automagically attached when launching jmeter.
This mojo is typically invoked as part of a nightly build.
Example:
<project>
...
<profiles>
<profile>
<id>nightly</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>chronos-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<input>${basedir}/src/main/resources/simplewebplan.jmx</input>
</configuration>
<executions>
<execution>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>chronos-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
</plugin>
</plugins>
</reporting>
</profile>
</profiles>
...
</project>Note the usage of a profile, to shield the normal build from the typically slow execution of the perofrmancetest.
It is possible to control the jmeter execution by specifying launch parameters. The details of the possible parameters can be seen at chronos:jmeter. The parameters include memory management and garbage collection. Note that most of these only affect the jmeter process, so they are probably not relevant when testing a web application.
It is perfectly legal to perform several performancetests as part of the same build. If your project needs both load testing an endurancetesting it can be done in one of two ways.
When an inputfolder is specified, instead of a file, performancetests based on all .jmx files in that folder will be executed.
Another way is to explicitly name the files.
Example:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>chronos-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<phase>integration-test</phase>
<id>simple</id>
<configuration>
<input>${basedir}/src/main/resources/simplewebplan.jmx</input>
</configuration>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<execution>
<phase>integration-test</phase>
<id>codehausmojo</id>
<configuration>
<input>${basedir}/src/main/resources/codehausmojowebplan.jmx</input>
</configuration>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>It is possible to use this goal to integrate the result of an externally executed test instead of invoking it directly. This is done by specifying a single jtl-file as input parameter. Note that this usage only allows a single file to be specified (as opposed to the normal usage when using jmx file(s) as input).