Run Gatling load tests on LambdaTest HyperExecute with configurable workload models, injection profiles, and automatic HTML report generation.
- A Spring Boot application (
GatlingDemoApplication) that exposes two endpoints:GET /greet/{name}— returns a greeting messageGET /slow— responds after a random delay (0-3000 ms)
- A Gatling simulation (
GreetingSimulation) that load-tests both endpoints with configurable injection profiles and workload models. - An HYE.yaml configuration to run the tests on HyperExecute.
- Java 17+
- Maven 3.6+
- A LambdaTest account with HyperExecute access
- HyperExecute CLI binary (download here)
- Environment variables set:
export LT_USERNAME=<your-lambdatest-username> export LT_ACCESS_KEY=<your-lambdatest-access-key>
git clone <repo-url>
cd gatling-hyperexecute-sampleThe HYE.yaml file defines the entire test execution pipeline:
version: 0.1
runson: linux
autosplit: true
concurrency: 1
scenarioCommandStatusOnly: true
# Starts the Spring Boot app in the background as the test target
background:
- mvn spring-boot:run -Dspring-boot.run.main-class=dev.simonverhoeven.gatlingdemo.GatlingDemoApplication || true
runtime:
- language: java
version: "17"
# Downloads Gatling HTML reports after the run
uploadArtefacts:
- name: TestReport
path:
- target/gatling/**
# Resolves Maven dependencies before running tests
pre:
- mvn dependency:resolve
# Configurable test parameters
vars:
INJECT_TYPE: constantUsersPerSec
WORKLOAD_MODEL: open
USERS: 10
DURATION: 30
RAMP_DURATION: 60
USERS_START: 5
USERS_END: 10
testDiscovery:
type: raw
mode: static
command: echo "Test"
# Runs the Gatling simulation with the configured parameters
testRunnerCommand: >
mvn gatling:test
-Dgatling.jvmArgs="-DinjectType=${INJECT_TYPE}
-DworkloadModel=${WORKLOAD_MODEL}
-Dusers=${USERS}
-Dduration=${DURATION}
-DrampDuration=${RAMP_DURATION}
-DusersStart=${USERS_START}
-DusersEnd=${USERS_END}"
retryOnFailure: true
maxRetries: 1
jobLabel: [Performance, Gatling]Edit the vars section in HYE.yaml to change load test behavior:
| Variable | Default | Description |
|---|---|---|
INJECT_TYPE |
constantUsersPerSec |
Injection profile (see table below) |
WORKLOAD_MODEL |
open |
open (arrival rate) or closed (concurrent users) |
USERS |
10 |
Number of users |
DURATION |
30 |
Test duration in seconds |
RAMP_DURATION |
60 |
Ramp-up duration in seconds |
USERS_START |
5 |
Starting user count (for ramp profiles) |
USERS_END |
10 |
Ending user count (for ramp profiles) |
Supported Injection Types:
| Inject Type | Workload Model | Behavior |
|---|---|---|
constantUsersPerSec |
open | Constant arrival rate of USERS users/sec for DURATION seconds |
rampUsersPerSec |
open | Ramps from USERS_START to USERS_END users/sec over DURATION seconds |
stressPeakUsers |
open | Stress test peaking at USERS over DURATION seconds |
soakTest |
closed | Ramps concurrent users from 1 to USERS over DURATION seconds |
capacityTest |
closed | Ramps concurrent users from 1 to USERS over DURATION seconds |
constantUsers |
open | Ramps USERS over RAMP_DURATION seconds |
./hyperexecute --user {userName} --key {accessKey} --config HYE.yamlTo override variables at runtime without editing the YAML:
./hyperexecute --user {userName} --key {accessKey} --config HYE.yaml --vars "USERS=20,DURATION=60,INJECT_TYPE=soakTest"After the job completes:
- Go to HyperExecute Dashboard to see job status
- Download the TestReport artefact — it contains the Gatling HTML report under
target/gatling/
For UI-based execution, you update the GreetingSimulation.java file directly in the project with your desired test configuration, then trigger the run from the HyperExecute dashboard.
Edit src/test/java/example/GreetingSimulation.java to configure your test:
- Base URL: Change
http://localhost:8080to your target application URL if testing an external service - Endpoints: Modify the HTTP requests to match your API under test
- Injection profile: Adjust the
setUp()method or the default system property values for users, duration, etc.
Commit and push your updated simulation to the repository:
git add src/test/java/example/GreetingSimulation.java
git commit -m "Update simulation for target service"
git push- Log in to LambdaTest
- From the left sidebar, go to HyperExecute
- Click Run New Job
- Select your Git Repository and branch
- HyperExecute auto-detects the
HYE.yamlin the root directory - Click Run
HyperExecute will:
- Spin up a Linux VM with Java 17
- Resolve Maven dependencies
- Start the Spring Boot application in the background
- Execute the Gatling simulation
- Upload the Gatling HTML report as an artefact
- Monitor real-time logs in the Jobs tab
- Once completed, go to the job details page
- Click on Artefacts > TestReport to download the Gatling HTML report
- Open the
index.htmlinside the downloaded report to see detailed performance metrics:- Response time distribution
- Requests per second
- Active users over time
- Percentile response times
To run the tests locally for development:
# Start the Spring Boot app
mvn spring-boot:run &
# Run Gatling tests with default parameters
mvn gatling:test
# Run with custom parameters
mvn gatling:test -Dgatling.jvmArgs="-DinjectType=constantUsersPerSec -DworkloadModel=open -Dusers=5 -Dduration=15"Reports are generated at target/gatling/greetingsimulation-<timestamp>/index.html.
gatling-hyperexecute-sample/
├── HYE.yaml # HyperExecute configuration
├── pom.xml # Maven config (Spring Boot + Gatling)
├── src/
│ ├── main/java/.../
│ │ ├── GatlingDemoApplication.java # Spring Boot app (test target)
│ │ └── MainController.java # REST endpoints (/greet, /slow)
│ └── test/java/example/
│ └── GreetingSimulation.java # Gatling load test simulation
└── target/gatling/ # Generated reports (after test run)