An example Gatling Maven project using Java DSL.
- Java 21
./mvnw clean package
Using the executable jar file (run-simulation-using-jar.sh
):
JAVA_OPTS="-DbaseUrl=http://localhost:8080 -DdurationMin=1 -DrequestPerSecond=10"
SIMULATION_NAME=gatling.test.example.simulation.ExampleSimulation
java ${JAVA_OPTS} -cp target/gatling-java-example.jar io.gatling.app.Gatling --simulation "${SIMULATION_NAME}" --results-folder results
Using the Gatling Maven plugin (run-simulation-using-plugin.sh
):
./mvnw -DsimulationClass=gatling.test.example.simulation.ExampleSimulation gatling:test
Using the Docker container (run-simulation-using-docker.sh
):
./mvnw clean package
docker build -t gatling-java-example:main .
docker run -e "JAVA_OPTS=-DbaseUrl=http://localhost:8080 -DdurationMin=1 -DrequestPerSecond=10" \
-e SIMULATION_NAME=gatling.test.example.simulation.ExampleSimulation gatling-java-example:main
As Kubernetes Job:
- Ensure you have Helm installed and can deploy to a Kubernetes cluster locally.
cd deployment/k8s/helm
make package install