Performance Testing with Gatling, Maven and Scala

This post shows how to set up a Gatling simulation test using Maven and Scala on IntelliJ IDE.

If you don’t already have Scala plugin for IntelliJ IDE, you can install it from the plugins section under preference:

scala plugin for intellij

Once the Scala plugin is installed, then you need to create a Maven project and choose a Scala archetype


If the desired archetype is not listed, you can click the “Add archetype” button and add the following details


Next, add the following section to the pom file which indicates which version of libraries we will be using


Then, add the required Scala and Gatling dependencies in the pom file


And finally, add the build section in the pom file

      <!-- Gatling Maven plugin that runs the load-simulation. -->

Once all the sections in the pom file have been updated, we are now ready to create a Gatling simulation class in Scala.

  • In src/test/scala, create a package named com.example.gatling.simulations.
  • In this package, create a Scala class named HttpSimulation with the following implementation.
package com.example.gatling.simulations

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.http.config.HttpProtocolBuilder.toHttpProtocol
import io.gatling.http.request.builder.HttpRequestBuilder.toActionBuilder

  * Example Gatling load test that sends two HTTP requests to the same URL.
class HttpSimulation extends Simulation {

    val theHttpProtocolBuilder = http

    val theScenarioBuilder = scenario("Scenario1")


To execute your test, just run

mvn gatling:execute