Skip to content

Demonstration of a load test for the jpetstore web application using an Apache JMeter script. Load test and results analysis are using Maven plugins or tools.

License

Notifications You must be signed in to change notification settings

vdaburon/jpetstore_loadtesting_dzone

Repository files navigation

Load test for JPetstore Web application using Maven files to launch load test and results analyse

Demonstration of a load test for the jpetstore web application using an Apache JMeter script. Load test and results analysis are using Maven plugins or tools.

Main page of the JPetstore Web Application

Web application JPetstore

The web application being tested is a well-known application called JPetstore (whose project can be found at https://github.com/mybatis/jpetstore-6).

Files location

By default, for the "JMeter Maven plugin", the files must be located in the directory: src/test/jmeter

  • jpetstore.jmx: the JMeter script with 2 thread groups for 2 different scenarios:
    • Scenario 1, SC01 prefix - browsing and adding items (pets) to the shopping cart
    • Scenario 2, SC02 prefix - searching for and viewing a pet's details
  • pet_search.csv: the file containing pet names for the search function
  • conf*.properties: multiple properties files for different load test configurations (number of virtual users, duration and hostname)
    • config_test_50pct_10min.properties, you need to set a jpetstore_host and a jpetstore_appli_path to your own running JPetstore Web Application Instance
    • config_test_100pct_20min.properties, you need to set a jpetstore_host and a jpetstore_appli_path to your own running JPetstore Web Application Instance
    • config_test_warm_up.properties, you need to set a jpetstore_host and a jpetstore_appli_path to your own running JPetstore Web Application Instance
    • config_test_warm_up_octoperf.properties, ready to test the Octoperf JPetstore instance (https://petstore.octoperf.com).
  • user.properties: the JMeter configuration file, specifically setting the date and time format (jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS) and the delimiter (jmeter.save.saveservice.default_delimiter=;) which are not the default values for JMeter.

Note: The jpetstore.jmx use a no standard plugin call "vdn@github - pacing-jmeter-plugin" to compute the pacing (mininum time before iteration), this plugin is declared in the "pom_01_launch_test.xml" and download by the "JMeter Maven plugin".
If you want to open the JMeter script in the JMeter Swing GUI, this plugin usually is installed "manually" with the JMeter plugins-manager (https://jmeter-plugins.org/install/Install/).

Maven pom.xml files

The pom.xml files are located at the root of the Maven project.

  • pom_01_launch_test.xml: This step 01 launch the load tests, the results will be stored in the target/jmeter/results directory.
  • pom_02_analyse_results.xml: This step 02 filters urls and generates graphs and reports based on the JMeter test results, and also generates an index.html file.

JPetstore load test maven

Step 1 - Running the load test

Test is launched using Maven with default values:

  • Maven pom file "pom_01_launch_test.xml", this pom contains the maven plugin "jmeter-maven-plugin" (project url: https://github.com/jmeter-maven-plugin/jmeter-maven-plugin)
  • The configuration file for the property: config_properties_name=config_test_warm_up.properties
  • The JMeter script jpetstore.jmx for the property: prefix_script_name=jpetstore
mvn clean verify -f pom_01_launch_test.xml

is equivalent to:

mvn -Dconfig_properties_name=config_test_warm_up.properties -Dprefix_script_name=jpetstore clean verify -f pom_01_launch_test.xml

Note: Before running the test, you need to set a jpetstore_host and a jpetstore_appli_path to your own running JPetstore Web Application Instance in the propertie files.

Example with an external configuration file: config_test_50pct_10min.properties

mvn -Dconfig_properties_name=config_test_50pct_10min.properties clean verify -f pom_01_launch_test.xml

This load profile corresponds to a test at 50% load for 10 minutes.

Another example with a second external configuration file: config_test_100pct_20min.properties

mvn -Dconfig_properties_name=config_test_100pct_20min.properties clean verify -f pom_01_launch_test.xml

This load profile corresponds to a test at 100% load for 20 minutes.

Running a short warm up load test for the Octoperf JPetstore

mvn -Dconfig_properties_name=config_test_warm_up_octoperf.properties clean verify -f pom_01_launch_test.xml

diagram launch load test with jmeter-maven-plugin

Step 2 - Analyzing the Test Results

After the load test, to analyze the test results, run a Maven command using the dedicated configuration file: pom_02_analyse_results.xml.

Important: DO NOT run a Maven clean command, as this would delete the load test results files in the target/jmeter/results directory.

This maven file pom_02_analyse_results.xml contains :

Starting the results analysis with command:

mvn verify -f pom_02_analyse_results.xml

In the results directory, you will find the graphs, CSV files containing the reports, HTML tables summarizing the reports, and the index.html page, which provides a single-page overview of the results and links to the various files.

diagram analyse results

This directory is located at target/jmeter/results within your project.

Example directory content target/jmeter/results

The generated index.html page allows you to view the graphs and links in a web browser.

Page index.html open in a browser (extract)

The JMeter log file is located in the directory:

target/jmeter/results (this is not the default directory; the pom.xml file pom_01_launch_test.xml was modified to specify the log file location:<logsDirectory>${project.build.directory}/jmeter/results</logsDirectory>) with the filename being the script name + ".log", e.g: jpetstore.jmx.log

Versions

Version 1.0 2025-11-12, first version for GitHub.

About

Demonstration of a load test for the jpetstore web application using an Apache JMeter script. Load test and results analysis are using Maven plugins or tools.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published