How to Install Gatling on Ubuntu
Gatling is great for load testing with lots of useful options. Learn how to install iton Ubuntu so you can get started!
Join the DZone community and get the full member experience.
Join For FreeLoad testing with the Gatling framework provides many powerful options, like assertions and flexibility. You can read more about Gatling here. But to get started, you need to have Gatling installed. This blog post will teach you how to install Gatling on Ubuntu, through the CLI. If you need to install Gatling on Windows, click here.
Update the Ubuntu packages to the latest version by executing the command sudo apt-get update
Currently, Gatling only supports JDK8 so we will install it by executing the commands below:
Add Oracle's PPA (Personal Package Archive) to the list of sources so that Ubuntu knows where to check for the updates.
add-apt-repository ppa:webupd8team/javaInstall JDK8 using the following:
apt-get install oracle-java8-installerIf you have multiple java packages installed on your machine, decide which version to use as the default type by using the following command:
update-alternatives --config javaSet the JAVA_HOME environment variable by executing the commands below:
Open the /etc/environment file by the command vi /etc/environment
Add the following line at the end of the file and save it.
JAVA_HOME="/usr/lib/jvm/java-8-oracle"Check to make sure java is installed on the machine by executing the command java -version. Here we can see "java current version," "java environment version," and "java server version."
Download the Gatling zip file by executing the command wget https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/2.3.1/gatling-charts-highcharts-bundle-2.3.1-bundle.zip
Move the file to our directory and unzip the file. In this example we moved it to /root and unzipped the file:
Then we have:
Set the GATLING_HOME environment variable by executing the commands below:
Open the /etc/environment file with the command vi /etc/environment
Add the following line at the end of the file and save it:
GATLING_HOME="/root/gatling-charts-highcharts-bundle-2.3.1"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:
- Go to the bin directory with the command cd gatling-charts-highcharts-bundle-2.3.1/bin/
- Run the command ./recorder.sh. A recorder window will be automatically displayed. This is the default:
From here on, you can customize and record scenarios.
- Go to the bin directory with the command cd gatling-charts-highcharts-bundle-2.3.1/bin/
- Run the command ./gatling.sh. Load testing information will be displayed on the terminal, such as: the GATLING_HOME variable, Scripts, etc.
Choose the script file you want to execute from there.
That's it!
You can also take your Scala file and run it in BlazeMeter. You will be able to massively scale it and get immediate reports with advanced KPIs.
Published at DZone with permission of Phi Nguyen, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments