Step By Step Guide For Gatling Installation And Configuration.

This article provides a detailed guide for Gatling installation and configuration.

Prerequisites

Download and install the below-mentioned software and tools to start with the Gatling tool.

  • Java JDK(Version 8+)

Download JDK from the Oracle website and configure the Java_Home variable. After successful configuration check the java version.

  • An IDE (IntelliJ/VSCode)

Download and install an IDE of your choice.

  • Maven or Gradle

Installation Of Gatling

Gatling performance and load testing tools can be installed in 3 ways.

1)Standalone mode(By Unzipping the files)
2)By Using Maven
3)By Using Gradle

A)Standalone Mode

To run with Gatling as quickly as possible, the standalone version is a great place to start.

1)Navigate to this link.
2)Click on Open-Source.
3)Click on Download Now.

A Zip file will be downloaded which we need to extract and save on our machine. Open up the extracted directory and navigate to the bin folder.

Gatling Installation And Configuration

In the bin folder, multiple .bat and .sh files are available.

Gatling Recorder for Windows: If we want to work with the recorder in Windows then we first need to set %GATLING_HOME%\bin in the path variable. Then go to bin and double-click on the recorder.bat file which will launch the command prompt and the Gatling recorder will display.

Gatling Recorder for macOS: For MacOs open the recorder. sh from the command line.

To start the Gatling performance tool in the Mac/Unix operating system use the gatling.sh file.

To start the Gatling performance tool in the Windows operating system use the gatling.bat file.

Gatling Example Simulation In MAC/UNIX:

Gatling bundles with example simulation scripts by default. We can choose any of the simulations we want to execute out of these scripts.

1)Go to Terminal
2)Navigate to the location where the Gatling directory is saved.
3)Navigate to the bin folder.
4)Execute ./gatling.sh 
5)Choose a simulation number(0 for basic simulation)
6)Enter run description(This description will be visible on the generated report, however, it is completely optional).

Gatling basic simulation

Once the simulation is done, Gatling will also print out a link to the full test report that is automatically created at the end of each test execution. A detailed report has been generated under the “results” folder.

Please open the following file: /Users/user/Desktop/gatling-charts-highcharts-bundle-3.7.6/results/basic simulation-20200916072019032/index.html

B)Gatling installation using Maven

Maven configuration can be done in 2 ways for Gatling.

1)Create a New maven project

  • Create a new Maven project
  • Open pom.xml
  • Add gatling-maven-plugin
  • Add gatling-charts-highcharts
<dependencies>
  <dependency>
    <groupId>io.gatling.highcharts</groupId>
    <artifactId>gatling-charts-highcharts</artifactId>
    <version>MANUALLY_REPLACE_WITH_LATEST_VERSION</version>
    <scope>test</scope>
  </dependency>
</dependencies>

<plugin>
  <groupId>io.gatling</groupId>
  <artifactId>gatling-maven-plugin</artifactId>
  <version>LATEST_VERSION</version>
</plugin>

2)Clone existing Gatling Java project

  • Go to this repo
  • Clone this repo
  • Open the demo project from the cloned repository in the IDE
  • Clean and build the project.

Gatling installation using Gradle

Gradle is a build management tool like Maven. In the Gradle project open the build.xml file and add the below-mentioned dependency.

plugins {
  id "io.gatling.gradle" version "3.7.6.3"
}

To run all the simulations in the Gradle project use

gradle gatlingRun

To run a single simulation specified by its name use the below command

gradle gatlingRun-MySimulationName

Discover more from AutomationQaHub

Subscribe now to keep reading and get access to the full archive.

Continue reading