Gatling is designed to treat your performance tests as production code. Maintenance and automation are made easier.
Before running tests, it would be wise to ensure your network/server host is aware and OK to support the testing as these can draw a lot of resources and bandwidth. - you don't want to perform any unintended DoS!
##Dependencies
From the IDE terminal or command line, ensure you are at the root dir of the project
Run all simulations
mvn clean gatling:test
Run specific simulation
mvn clean gatling:test -Dgatling.simulationClass=simulations.SampleSimulation1
View results
- Results are packaged as Highcharts reports: target/gatling/{simulation}/index.html
- Note that by using the mvn 'clean' command, existing reports will be removed before each run
##Configuration
###Gatling-Maven-Plugin Gatling is run through a maven plugin as detailed in pom.xml.
###Gatling The Gatling plugin has a most configurations setup however you can override these in /resources/gatling.conf
directory {
data = ./data # Folder where user's data (e.g. files used by Feeders) is located
bodies = ./bodies # Folder where bodies are located
simulations = ../scala/simulations # Folder where the bundle's simulations are located
#reportsOnly = "" # If set, name of report folder to look for in order to generate its report
#binaries = "" # If set, name of the folder where compiles classes are located
#results = results # Name of the folder where all reports folder are located
}
Of particular note is the results folder if you want to maintain results outside of the default target directory
###Gatling recorder Recorder config is detailed in /resources/recorder.conf however many of these can also be set from the recorder GUI
A quick way to generate new simulations is to use the bundled recorder /recorder/Recorder
- From within your IDE, Run the Recorder scala object, this will launch the GUI
- By default, this will output the recording as 'RecordedSimulation.scala' in the simulations folder
- See the Gatling help docs for setting up your browser and using the recorder
- Once you have a recording you'll want to separate out your scenario and simulation
Gatling has a number of options for testing the desired performance requirements.
setUp(
scn.inject(
nothingFor(4 seconds),
atOnceUsers(10),
rampUsers(10) over (5 seconds)
constantUsersPerSec(20) during (15 seconds),
constantUsersPerSec(20) during (15 seconds) randomized,
rampUsersPerSec(10) to 20 during (10 minutes),
rampUsersPerSec(10) to 20 during (10 minutes) randomized,
splitUsers(1000) into (rampUsers(10) over (10 seconds)) separatedBy (10 seconds),
splitUsers(1000) into (rampUsers(10) over (10 seconds)) separatedBy atOnceUsers(30),
heavisideUsers(1000) over (20 seconds)
).protocols(httpConf)
)