Running Load Tests From Maven

Applies to ReadyAPI 3.53, last modified on June 26, 2024

If you are using Maven in your development environment, you can include ReadyAPI Performance tests in your builds. To do so, you command Maven to download and use the ReadyAPI Maven plugin in your project.


To run load tests from Maven, you need to have the following on the computer, where you are going to run a Maven build:

You do not need to configure your environment specifically for running load tests, and any required dependencies will be handled by Maven.

Pom File

Maven reads details about the build from the pom.xml file. You need to configure it to get the ReadyAPI plugin from the Maven repository and add a load test to the test phase of the build lifecycle.

You can find a sample Maven configuration below. If you already have your own configuration, copy the necessary elements to it.

Running Load Test

To start the load test, use the Maven test command in the folder with your pom.xml file. This command will run the load test and generate reports for it. For example:

C:/Work/MvnSample> mvn test

If your tests use the Maven SureFire plugin to create reports, use the site command instead.

C:/Work/MvnSample> mvn site

Sample Maven Load Test

Below is a sample pom.xml file that runs the Baseline-load-test-project.xml project. You can find this project in the <ReadyAPI installation directory> folder. To use the sample:

  • (Optional) Start virtual service from the project. This step is not required, but having a running virtual service will provide meaningful results.

  • Create a new pom.xml file and copy the sample code to it. Make sure to specify the same version as the ReadyAPI version you have.

  • Place the Baseline-load-test-project.xml project file in the folder where the pom.xml file is located.

  • Run the Maven build by using the mvn site command as described above.

You can specify additional properties of the load test by removing comments on unused elements and entering the parameters.

If you already have a pom.xml file, copy the elements to it to include a load test in the build.

<project xmlns="" xmlns:xsi=""
   <!--Add the SmartBear ReadyAPI plugin repository.-->
   <!--Maven will download the plugin from the specified URL.-->


            <!--Plugin groupID used to uniquely identify the project with the plugin.-->
            <!--Plugin artifactId used to find the plugin in the project.-->
            <!--Specifies your ReadyAPI version. Maven will use the appropriate plugin version.-->
            <!-- IMPORTANT: Must be the same as your ReadyAPI version.-->


                  <!--Specifies the lifecycle phase to run load tests .-->
                  <!--We recommend using the test phase.-->
                     <!--Do not change. Commands the Maven plugin to run a load test.-->


                     <!--Required. Specifies the path to the project to be executed.-->
                     <!--Required. Specifies the name of the load test to be run.-->
                     <loadTest>Baseline Load Test (Geocoding)</loadTest>
                     <!--Required for reports. Specifies the format of the report to be generated.-->
                     <!--Possible values: PDF, XLS, HTML, RTF, CSV, TXT and XML. --> <reportFormat>PDF</reportFormat>
                     <!--Required for Maven Surefire reports. Must be true. -->
                     <!--Commands ReadyAPI Performance to generate JUnit-style reports.-->
                     <!--Required for> Maven Surefire reports. Must be as shown. -->
                     <!--Specifies the folder to store reports in. -->

                     <!-- ========= Additional elements ============= -->

                     <!--If true, commands Maven to continue the test run even when an assertion triggers.-->
                     <!--Specifies the number of virtual users to be simulated. -->
                     <!--Has no effect if the "Per Scenario" load distribution is used.-->
                     <!--Specifies existing statistics groups to be included in the report.-->
                     <!--Specifies limits for the test run. -->
                     <!--Syntax: <SECONDS>:<TARGETS>:<FAILURES> (for example, 60:0:200)-->
                     <!--Project-defined time limits override this value.-->
                     <!--Specifies the .CSV file to export the statistics group to. Syntax: <FileName>=<StatGroupName>-->
                     <!--Specifies if the runner terminates requests running at the moment the test is stopped.-->
                     <!--If true, ongoing requests will be canceled.-->
                     <!--Otherwise, the test will finish when all requests are completed.-->
                     <!--If not specified, project properties are used.-->
                     <!--Specifies if the load is simulated from the local computer.-->
                     <!--If true, the local computer is used. If false, configured agents are used.-->
                     <!--If not specified, project properties are used.-->
                     <!--Specifies the remote agents to be used for the test run. Syntax: <hostname[:port]>scenario</hostname[:port]>) -->
                     <!--Sets the output folder for reports.-->
                     <!--Specifies a settings file to be used.-->
                     <!--Specifies a password for the encrypted settings file.-->
                     <!--Specifies a password for the encrypted project file-->
                     <!--Specifies the value of a global property for the test run. Syntax: <variable>=<value>-->
                     <!--Specifies the value of a project property for the test run. Syntax: <variable>=<value>-->
                     <!--Provides access to ReadyAPI properties.-->
                     <!--If true, ReadyAPI will not send usage statistics.-->
                     <!--Specifies the environment to be used in the test run.-->

                     <!-- ========= /Additional elements ============= -->




Information on Plugins Used

This example uses the Maven Surefire Plugin to generate JUnit XML reports and Maven Site Plugin to improve test stability. Depending on the changes to the plugins, you may need to change the pom.xml file. For additional information about configuring these plugins, see their documentation.

See Also

ReadyAPI Test Testing With Maven - Example

Highlight search results