Testing Node.Js Application with Gatling

Reading Time: 2 minutes

In one of our project we needed to test a node.js application, so in this blog, I’ll be discussing node.js application using Gatlingjs.


Gatlingjs is an npm library to run gatling from a node.js project by placing the simulation files in your project repository.


In order to setup Gatling, your system should have JDK8 and Scala installed so following are the links to install them:

1. JDK 8 installation guide

2. Scala installation guide

If you are using an IDE (i.e IntelliJ) you just need to install scala plugin.

Installation of gatlingjs

Execute following commands to install gatlingjs:

Sudo apt-get install npm

npm i gatlingjs -D

Configuration of Project Structure

To run simulations you have to configure your project library. Gatlingjs requires following directories where you keep your simulation files so that gatlingjs can identify the specific simulation to perform testing.


As you can see in the above picture, various directories are created which required by gatlingjs in the project root

  • test/performance/results

    This directory contains the HTML representation of the report

  • test/performance/user-files/simulations 

    This directory contains the .scala files for the simulation

  • test/performance/user-files/data

    This directory contains the data feeds

  • test/performance/user-files/bodies

    This directory contains the things related to request body

Starting Gatlingjs simulation

To start the simulation you need to execute the following command


After executing the command in the terminal the testing simulation will start running

Screenshot from 2018-10-17 13-17-37

You can see in the above picture an example of running simulation.

After completing the simulation you can check the HTML report generated in the result directory or you can open the report in any browser by copying the path of the index.js file from the end of your simulation and directly paste it into your browser.



As you can see above pictures are example report generated.


References :






Written by 

Abhishek is Software Consultant having experience of more than 7 months. He is familiar with Java, Scala, Android Development, HTML, CSS, JS, MySQL, Apache Spark, and Unity Development. He is always passionate, techie and eager to learn new technologies & apply them in respective projects. On a personal front, Being a joystick junky he enjoys playing games on PC, PSP and other consoles as well as developing them.