Getting Started with Gatling
Updated: 5 days ago
In this post, I will be taking you through end to end steps to install Gatling in standalone mode on windows. Steps include Prerequisites, Gatling installation in standalone mode, verify the installation by running Gatling sample test script and report generation.
For more detailed action & description including Gatling bundle structure, script structure & reporting, recording a new script- visit youtube series on Gatling
This post aims at giving you quickstart to Gatling.
It is a wonderful tool and paving its way to the most popular open-source performance testing tool. Being code based, it gives developers & testers flexibility control over the scripts which can be easily maintained! Gatling takes an edge over traditional UI based performance testing tools like JMeter.It meets demands of early performance testing & integrates well in a DevOps environment.
See in Action : GATLING: KEY FEATURES
MILESTONE STEPS TO GET STARTED WITH GATLING
Gatling is written in scala which in turn runs primarily on the Java Virtual Machine (JVM).
Before you go ahead, always refer to requirements of Gatling latest version for scala and JVM.
These are mentioned on Gatling documentation page -https://gatling.io/docs/current/installation/
Having correct scala & jvm version is really important, else you will face trouble while creating or running your scripts.
By the time this post is written Gatling is on version 3.3 & below are the version prerequisites:
As per Gatling Documentation :
Gatling supports 64bits OpenJDK 8 and OpenJDK 11 with HotSpot. Other JVMs such as JDK 12+, client JVMs, 32bits systems or OpenJ9 are not supported.
You can download & install hotspot OpenJDK 11 using ADOPTOpenJDK here. If you are not familiar with OpenJDK, please visit below to get introduced & install the same:
As the above video says, make sure that you get correct java version on giving command java --version
As per Gatling documentation:
Since 3.0, Gatling requires Scala 2.12. Gatling is not compatible with Scala 2.11 nor Scala 2.13
As per Scala Documentation, Scala 2.12 is compatible with JVM 8 & 11, hence the need of this prerequisite.
We generally need scala when we want to edit our script. In a practical implementation of Gatling, we need to create integrated Gatling environment by installing IDE(IntelliJ or SBT) and then we install Scala plugin on top of that.
Here we will not be editing script, all we will be doing is recording and running script so we will not be installing scala.
In case you wish to edit a script, you can install scala for windows from here :
Now once we are done with the installation of Prerequisites, we need to download Gatling bundle
Current version during the time of post is 3.3.
Once a bundle is downloaded, unzip it to any desired location
This bundle works on any OS including Linux, MAC & Windows.
For Windows -Do not unzip the folder in Program files as you may face permission issues
Once the folder is unzipped in the desired location, installation is complete :)You should see a structure like below in the folder:
user-file folder contains a sample test script which tests Gatling provided demo application.
the bin folder contains executable - gatling.bat for windows & Gatling shell script for mac & Linux
Gatling installation can be verified by running a sample script from Gatling which is available in the user-files folder. To do the same:
Open a command prompt & go to the location of gatling.bat - <Gatling>/bin
Run command gatling.bat
If the java environment is correctly set, you will be prompted to use Simulation number(script to be run) from available sample scripts. Choose any say 0 (for the first script)
Press enter when prompted for a run description
The script should run successfully
Finally, the report should be generated in Gatling results folder
The main report can be opened through the index HTML document. Once open, you will see details formatted in a colourful manner.
This completes verification of standalone installation of Gatling.
Don't limit yourself to beginner level ! Ask for 90 % off coupon code on complete course on Gatling available on Udemy !