Hi everybody,
I have a problem, when I try to pass external parameters in gatling 2 I receive an error. I used the example for gatling 1
val nbUsers = java.lang.Integer.getInteger(“users”, 1)
val myRamp = java.lang.Long.getLong(“ramp”, 0L)
and I applied in the new API of gatling 2, but I’m not an expert of Scala:
setUp(scn.inject(atOnce(nbUsers users), ramp(10 users) over (myRamp seconds))).protocols(httpProtocol)
During the compilation I have this error:
value users is not a member of Integer
[main][ERROR][ZincCompiler.scala:98] i.g.a.ZincCompiler$ - setUp(scn.inject(atOnce(nbUsers users), ramp(10 users) over (myRamp seconds))).protocols(httpProtocol)
We’ve just introduced a way to have this kind of things work as is in master/next 2M4.
Until then, you have to convert your java.lang.Integer into scala.Int: java.lang.Integer.getInteger(“users”, 1).toInt
Hi,
now everything works well, but when I try to pass those parameters from the maven gatling plugin the compiled class doesn’t receive the parameter and it always uses the default values.
The only way I’m able to pass parameters is through javaOptions in the build.sbt file.
Like follows:
javaOptions += "-DnrUsers=10"
But I actually want to be able to pass parameters from the command line, since this would require that I change the build.sbt file every time I want to change a property.
Unfortunately, SBT doesn’t pass system properties to its subprocessses (e.g. tests, main classes ran from SBT…).
The only other option I can think about is using environment variables, which you would then access in your simulation using :