In this article we will see how to use Gatling with Maven. This approach enables us to integrate Gatling as part of continuous integration. Along with that we will see how to externalize properties used in simulation script and the dynamic data feeding using Gatling feeders. Let us see the above said features in action.
As a first step create a maven project and add the below Gatling dependencies.
Now, we will externalize the baseURL property used in our simulation. For this add the application.properties file under src/test/resources and use ConfigFactory to get access to the properties. The sample simulation is given below.
Now, we will see how to add dynamic data used as part of simulation. For this I am using Gatling’s CSVFeeder. You can get more info on Gatling’s feeders http://gatling.io/docs/2.2.3/session/feeder.html. Add the feeder file under src/test/resources/data. The sample simulation using csv feeder is given below.
Run mvn gatling:execute to execute Gatling project which will run the simulations. The entire project used for this article is available on GitHub.