0% found this document useful (0 votes)
32 views

Gatling Introduction For Java Section-C

This document provides an overview of Section C of a Gatling introduction course, which covers Gatling test simulation design, execution, and reporting. It discusses open and closed workload models in Gatling, adding a simulation to a Gatling script, executing Gatling scripts via standalone, Maven, and Gradle, and Gatling test reports.

Uploaded by

CJ Ho
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Gatling Introduction For Java Section-C

This document provides an overview of Section C of a Gatling introduction course, which covers Gatling test simulation design, execution, and reporting. It discusses open and closed workload models in Gatling, adding a simulation to a Gatling script, executing Gatling scripts via standalone, Maven, and Gradle, and Gatling test reports.

Uploaded by

CJ Ho
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Gatling

Introduction for
Java Users

Section C - Accompanying Documentation


Table of contents

Section C Overview 3

Gatling Workload Models 4


Closed Workload 4
Open Workload 4

Adding Simulation Design to Script 5

Executing Gatling Scripts 6


Standalone Mode 6
Maven 6
Gradle 6
Gatling Test Reports 7

Gatling Academy - Gatling Introduction - Section C


Page 2
Section C Overview
Section C of this course is titled Gatling Test Simulation Design, Execution and
Reporting. The following topics will be covered:

● Open and Closed Workload Models


● Adding a Simulation to a Gatling script
● Executing Gatling via the Standalone Version
● Executing Gatling via Build Tools
● Gatling Test Reports

Gatling Academy - Gatling Introduction - Section C


Page 3
Gatling Workload Models
Gatling supports both the Open and Closed workload models. You can read more about the
differences between the workload models in this blog post -
https://gatling.io/2018/10/04/gatling-3-closed-workload-model-support/

The documentation on simulation design also has details of the differences between the
models and describes the DSL methods that Gatling provides for simulation design:
https://gatling.io/docs/gatling/reference/current/core/injection/#open-vs-closed-workload-mod
els

Closed Workload

The methods for a closed workload model are described here:


https://gatling.io/docs/gatling/reference/current/core/injection/#closed-model

Open Workload

The methods for an open workload model are described here:


https://gatling.io/docs/gatling/reference/current/core/injection/#open-model

Gatling Academy - Gatling Introduction - Section C


Page 4
Adding Simulation Design to Script
Gatling simulation design is defined in the setUp() block of your Gatling script, typically
located at the bottom. Here you can pick methods from the Gatling DSL to design load
simulations as you see fit.

This is an example of a simulation with 5 admin users that start at once, along with a number
of regular users that ramp at different intervals:

{
setUp(
admins.injectOpen(atOnceUsers(1)),

users.injectOpen(
nothingFor(5),
atOnceUsers(1),
rampUsers(5).during(10),
constantUsersPerSec(2).during(20)
))
.protocols(httpProtocol);
}

We can expect the scenario above to look something like this:

Good practice in designing your load simulation is to check this Active Users along the
Simulation graph in your Gatling test reports, and then adjust your load injection simulation
as required.

Remember to check the documentation (


https://gatling.io/docs/gatling/reference/current/core/injection/ ) for all the different injection
profiles that you can add into your Gatling script.

Gatling Academy - Gatling Introduction - Section C


Page 5
Executing Gatling Scripts

Standalone Mode

Executing Gatling in standalone mode means simply executing the gatling.sh or gatling.bat
file within the /bin folder of the Gatling download that you extracted on your machine.

Remember that your Gatling simulation scripts should be within the user-files/simulations
folder of that same repository, and any support files such as CSV data files should be in the
user-files/resources/data folder.

Maven

To execute a Gatling script through Maven, use the following command:

$ mvn gatling:test -Dgatling.simulationClass=computerdatabase.BasicSimulation

Refer to the Maven Plugin documentation for full instructions on using Gatling with Maven -
https://gatling.io/docs/gatling/reference/current/extensions/maven_plugin/

Gradle

To execute a Gatling script through Gradle, use the following command:

$ gradle gatlingRun-com.project.simu.MySimulation

Refer to the Gradle plugin documentation for full instructions on using Gatling with Gradle -
https://gatling.io/docs/gatling/reference/current/extensions/gradle_plugin/

Gatling Academy - Gatling Introduction - Section C


Page 6
Gatling Test Reports

Gatling produces a detailed graphical test report at the end of each test execution. The
report will look something like this:

Please refer to the documentation for a full breakdown of Gatling reports -


https://gatling.io/docs/current/general/reports/

Gatling Academy - Gatling Introduction - Section C


Page 7

You might also like