How to Install Gatling on Windows
Gatling is a powerful load testing tool for writing tests in Scala. You can read about Gatling’s abilities in the blog post “8 Reasons You Should Use Gatling for Load Testing”. The purpose of this blog is to show you how to install Gatling on your Windows machine, so you can start your load testing.
Let’s get started.
1. Go to Java SE Downloads on Oracle.
2. Currently Gatling only supports JDK8 so select the "JDK Download" of JDK8.
3. Select the "Accept License Agreement" radio button.
4. Select the appropriate installation. In this case, it is the 'Windows-64' bit. Click the appropriate link and save the .exe file to your disk.
5. Run the downloaded exe file to launch the Installer wizard. Click 'Next' to continue.
6. At this step you can select optional features to install, such as: install/don’t install “Source Code”, “Public JRE” or change the default installation folder of jdk8. But we will leave the default option that installs development tools+source code+public jre, and click 'Next'.
The installer will be extracted and the progress will be shown in the wizard.
7. Change the default installation folder of jre8 if you want to, but we recommend leaving the default and click 'Next'.
The installer will now install jre8 and the new files will be copied to the installation folder chosen above.
A successful installation looks like this:
8. This step we will set the environment variable for java. Right-click on “My Computer” and select “Properties”. Click the “Advanced system settings” button like the screenshot below:
9. Under the 'Advanced' tab, choose the “Environment Variables…” button.
10. If we want the environment variable for java to be used only by the current windows user, go to the User Variables for <user> section. If we want the environment variable for java to be used by all windows users, go to the System variables section. In this example we will choose the System variables and click on the “New...” button, as shown below:
11. Type in “Variable name” and “Variable value” with the variable name as the name of the environment variable for java and the variable value as the path directory of jdk8.
- Variable name: JAVA_HOME
- Variable value: C:\Program Files\Java\jdk1.8.0_171
Then we have:
12. Click on the “Path” variable as shown below.
13. Add a new line and type in %JAVA_HOME%\bin.
14. To verify the success of the installation, go to the command prompt and type 'java' as a command. The output of the command should look like below. If the Java installation is unsuccessful or if it had NOT been installed, it will throw an "unknown command" error.
1. Go the the download section on the Gatling website and click on the button “DOWNLOAD NOW!”. Note that the latest release is now Gatling 2.3.1.
There is no specific installer or exe file for Gatling. Only the bundles that need to be downloaded and unzipped.
2. After completing the download, unzip the zip file (gatling-charts-highcharts-bundle-2.3.1-bundle.zip) and copy all items to another folder. In this example I copied all items to a folder named gatling-charts-highcharts-bundle-2.3.1 in the C driver.
3. This step we will set the environment variable for Gatling. Right-click on “My Computer” and select “Properties”. Click the “Advanced system settings” button.
4. Under the 'Advanced' tab, choose the “Environment Variables…” button.
5. Like before, we will choose the System variables:
6. Type in the “Variable name” and “Variable value”. The variable value is the Gatling path directory.
- Variable name: GATLING_HOME
- Variable value: C:\gatling-charts-highcharts-bundle-2.3.1
Then we have:
8. Click on the “Path” variable as shown below.
9. Add a new line and type in %GATLING_HOME%\bin.
Congratulations! You now have Gatling installed! You can now start out with your first Gatling load test. You can start by recording scenarios, customizing the scripts to meet your purposes and executing them.
Here is a quick explanation:
Recording Your Gatling Scripts
1. Go to the bin folder (in this example C:\gatling-charts-highcharts-bundle-2.3.1\bin).
2. Double click on the “recorder.bat” file.
3. A command prompt window will be displayed.
4. A recorder window will be automatically displayed. This is the default:
From here on you can customize and record scenarios.
Executing Your Gatling Scripts
1. Go to the bin folder (in this example C:\gatling-charts-highcharts-bundle-2.3.1\bin)
2. Double click on the “gatling.bat” file. This is the Gatling execution file, which runs the test.
3. A command prompt window is displayed and then load testing information will be displayed on the command prompt window, such as: the GATLING_HOME variable, the Java execution file, Scripts, etc.
4. The Command prompt window will look like this:
5. Choose the script file you want to execute from there.
Running Your Gatling Test in BlazeMeter
After creating your Gatling script in Scala, you can upload it to BlazeMeter and easily run your test in a SaaS product. Enjoy an easy to use GUI, advanced reporting and collaboration capabilities.