Figure 6.24. Preparing a performance test script in JMeter
Note that we are also using the optional
memory—performance testing is a memory-hungry activity.
The script shown here will execute the JMeter performance tests against a running application. So you
need to ensure that the application you want to test is up and running before you start the tests. There
are several ways to do this. For more heavy-weight performance tests, you will usually want to deploy
your application to a test server before running the tests. For most applications this is not usually too
difficult—the Maven Cargo plugin, for example, lets you automate the deployment process to a variety
of local and remote servers. We will also see how to do this in Jenkins later on in the book.
Alternatively, if you are using Maven for a web application, you can use the Jetty or Cargo plugin to
ensure that the application is deployed before the integration tests start, and then call the JMeter Ant
script from within Maven during the integration test phase. Using Jetty, for example, you could so
something like this:
<project...>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.1.0.v20100505</version>
<configuration>