gatling-maven plugin - Accessing Plugin Configurations Set in POM.xml Within Simulation Scala files

Hi everyone,

I’m relatively new to Scala and Gatling but I have come across a problem that I can’t seem to figure out after searching the documentation and this group.

This is specific to the gatling-maven plugin (version 2.2.4).

In the pom.xml file, I am running different profiles and setting options for the gatling-maven plugin to override the default location of the dataFolder in specific instances.

FirstLoad

test

execute

${project.basedir}/src/test/resources/data/prod

Misc.First

My goal, is to be able to access the data contained within the configuration within the given Simulation file.

How can I access these variables in my Simulation Scala files? I know there are ways to get the gatling.conf vars and application.conf (if one exists) vars, but I’m speaking specifically about configuration changes outlined in the pom.xml?

Hi Justin,

I have a derived class ConfigurableSimulation to access that data


import io.gatling.core.config.GatlingConfiguration

abstract class ConfigurableSimulation(implicit configuration: GatlingConfiguration) extends Simulation {
val dataDirectory = new File(configuration.core.directory.data).getAbsoluteFile
val resultDirectory = new File(configuration.core.directory.results).getAbsoluteFile
}