Hi All,
I am trying to use a global variable to host a bunch of test parameters, but I don’t see expected values. For example (see [1] below), even if I set nbUsers to 5 in properties file, actual test results will show nbUsers is set to 2. The logging messages inside “before” block do show that nbUsers is set to 5 though. Can you please kindly point out what is the right way to do it? I am using Gatling 3.5.1.
Thanks
Henry
[1]
class MyTestSimulation2 extends Simulation {
val logger = org.slf4j.LoggerFactory.getLogger(“TestLogger”)
val props = new Properties()
before {
val file = new File("/opt/gatling/conf/gatling.properties")
if (file.exists()) {
val fileReader = new FileReader("/opt/gatling/conf/gatling.properties")
props.load(fileReader)
}
else {
logger.error("/opt/gatling/conf/gatling.properties does NOT exist!");
}
logger.info("nbUsers: " + props.getProperty(“nbUsers”, “2”))
logger.info("duration: " + props.getProperty(“duration”, “60”))
}
…
setUp(scnRunExec.inject(constantConcurrentUsers(props.getProperty(“nbUsers”, “2”).toInt)
during(props.getProperty(“duration”, “60”).toInt))).protocols(httpProtocol)