Package Generation

Generate a package from your Gatling bundle or with a Maven, sbt, or Gradle project.

Generating Packages for Gatling Enterprise

Gatling Enterprise deploys packages containing your compiled Simulations and resources. Those packages have to be generated upstream, using one of the methods below, before you can run them with Gatling Enterprise.

Gatling Enterprise is compatible with Gatling version from 3.5 to 3.11.2 included, however, these instructions are aligned with the new Maven-based bundle released in Gatling 3.11.

Gatling bundle

Once you have created a simulation you want to upload, you can use the enterpriseDeploy command to upload your package and simulation with the default configuration. To customize your package and simulation configuration, see the Configuration as code documentation.

To use the enterpriseDeploy command:

  1. Create an API token in Gatling Enterprise.
  2. Set the API token in your local environment.
  3. Run the enterpriseDeploy command:
./mvnw gatling:enterpriseDeploy
mvnw.cmd gatling:enterpriseDeploy

Alternatively, you can package your simulation and then upload it using the Gatling Enterprise UI. To package and upload your simulation:

  1. Run the command enterprisePackage in your local terminal:
./mvnw gatling:enterprisePackage
mvnw.cmd gatling:enterprisePackage
  1. Log in to Gatling Enterprise and go to the Packages page from the left-side navigation menu.
  2. Click + Create.
  3. Use the upload modal to name the package and assign it to a team.
  4. Upload the .jar file created in step 1 from your project’s target folder.
  5. Click Save.

Finally, you can get the list of all the available options with the help command:

./mvnw gatling:help
mvnw.cmd gatling:help

Maven, Gradle or sbt project

To set up you project, and to learn how to use you preferred build tool to upload your simulations to Gatling Enterprise Cloud, please refer to the documentation pages of the respective plugins:

Note on Feeders

A typical mistake with Gatling and Gatling Enterprise is to rely on having an exploded Maven/Gradle/sbt project structure, and to try to load files from the project filesystem.

This filesystem structure will not be accessible once your project has been packaged and deployed to Gatling Enterprise.

If your feeder files are packaged with your test sources, you must resolve them from the classpath. This will work both when you run simulations locally and when you deploy them to Gatling Enterprise.

// incorrect
val feeder = csv("src/test/resources/foo.csv")

// correct
val feeder = csv("foo.csv")

Load Sharding

Injection rates and throttling rates are automatically distributed amongst nodes.

However, Feeders data is not automatically sharded, as it might not be the desired behavior.

If you want data to be unique cluster-wide, you have to explicitly tell Gatling to shard the data, e.g.:

val feeder = csv("foo.csv").shard

Assuming the CSV file contains 1000 entries, and you run your simulation on 3 Gatling nodes, the entries will be distributed as follows:

  • First node will access the first 333 entries
  • Second node will access the next 333 entries
  • Third node will access the last 334 entries

Resolving Load Generator Location in Simulation

When running a distributed test from multiple locations, you could be interested in knowing where a given load generator is deployed in order to trigger specific behaviors depending on the location.

For example, you might want to hit https://example.fr if the load generator is deployed in the Europe - Paris location, and https://example.com otherwise.

In your simulation code, you can resolve the name of the location in which the load generator running the code is deployed:

val locationName = System.getProperty("gatling.enterprise.poolName") // pool is the former name of location
val baseUrl = if (locationName == "Europe - Paris") "https://example.fr" else "https://example.com"

Edit this page on GitHub