The Gatling bundle is an all-in-one project to get started quickly with Gatling. This bundle includes all the files and dependencies needed to run Gatling without having to configure dependencies manually. Its benefits include:
The Gatling bundle, however, has limitations for larger projects or deeper integration into the development process. These limitations are particularly true if you want to integrate load tests into a CI/CD pipeline. We recommend migrating to a dependency management tool like Maven at this stage for:
This guide details how to migrate your Gatling tests to Maven in less than 5 minutes.
To better understand the migration process, examining the operation and architecture of the Gatling bundle is helpful. The bundle combines the components necessary to run Gatling and has several important directories.
bin: This directory stores the Gatling and the Recorder start scripts.
conf: Housing the Gatling, Akka, and Logback configuration files; this directory is for the technical configuration of Gatling. You can configure the parameters of your tests and monitor the generated logs.
lib: This directory contains Gatling and its dependencies.
results: Stores your Gatling test results.
user-files: This directory centralizes your simulation scenarios. The simulations subfolder will receive the code for your Gatling tests. The resources subfolder hosts files other than the source code, such as feeder and templates for request bodies. You can also add dependencies in the lib subfolder.
Gatling recommends using an IDE like IntelliJ for writing and managing load tests. With IntelliJ, you can directly clone the plugin demo:
Go to File > New > Project from Version Control
Note on Gatling versions
To determine your Gatling bundle version, navigate to the dependencies folder lib and read the file name: gatling-charts-highcharts-3.x.x.jar. The 3.x.x indicates the Gatling version. For example, the current version is 3.9.5. Align the Gatling version in your Maven project configuration and the bundle to ensure successful synchronization.
Note that demo projects on GitHub use the latest version of Gatling. If your version is older and you prefer to keep the existing one, you must adjust the one in your Maven project.
Element | Location in the Bundle | Location in Maven | Mandatory |
Test Case | user-files/simulations/* | src/test/java/ | Yes |
Resources | user-files/resources/* | src/test/resources/ | Yes |
Gatling configuration | conf/gatling.conf | src/test/resources/gatling.conf | No |
Logback configuration | conf/logback.xml | src/test/resources/logback-test.xml | No |
Recorder configuration | conf/recorder.conf | src/test/resources/recorder.conf | No |
<!-- use the following if you're compiling with JDK 8-->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- comment the 2 lines above and uncomment the line bellow if you're compiling with JDK 11 or 17 -->
<!-- <maven.compiler.release>11</maven.compiler.release>-->
Or to configure the Gatling version:
<version>3.9.5</version>
Element | Location in the Bundle | Location in Maven | Mandatory |
Test Case | user-files/simulations/* | src/test/scala/ | Yes |
Resources | user-files/resources/* | src/test/resources/ | Yes |
Gatling configuration | conf/gatling.conf | src/test/resources/gatling.conf | No |
Logback configuration | conf/logback.xml | src/test/resources/logback-test.xml | No |
Recorder configuration | conf/recorder.conf | src/test/resources/recorder.conf | No |
<version>3.9.5</version>
After migrating your files from the Gatling bundle to your Maven project, it is time to validate the migration. For this, you can either use the Maven wrapper or locally install Maven.
For most projects, the Maven wrapper, built by Gatling, provides sufficient flexibility to run your load tests. To use the built-in wrapper, run the following command in the root directory of your Maven project.
#Linux and Mac OS
./mvnw gatling:test
#Windows
mvnw.cmd gatling:test
Some projects can’t use the wrapper due to corporate network restrictions or needing more fine-grained control of settings. In this case, installing Maven is a better choice. See the official Maven website for installation instructions.
To run your Gatling test with a local Maven installation, run the following command in the root directory of your project.
mvn gatling:test
Assuming your test ran successfully, you are finished! To learn more about using Maven and Gatling, we offer multiple resources: