Question

I'm using a parameter for my ramp value as per the docs,

val rampUpRate  = Integer.getInteger("ramp", 1)

setUp(
    scn.users(10).ramp(rampUpRate).protocolConfig(httpConf)
)

But when I run gatling, I'm getting an error:

09:57:35.695 [ERROR] c.e.e.g.a.ZincCompiler$ - /Gatling/user-files/simulations/clients/com/mydomain/www/stress/RecordedSimulation.scala:1088: overloaded method value ramp with alternatives:
  (duration: akka.util.Duration)com.excilys.ebi.gatling.core.scenario.configuration.ConfiguredScenarioBuilder <and>
  (duration: Long)com.excilys.ebi.gatling.core.scenario.configuration.Configured
ScenarioBuilder
 cannot be applied to (java.lang.Integer)

I thought I could simply cast to Long before using the parameter

val rampUpRate  = Integer.getInteger("ramp", 1)

setUp(
    scn.users(10).ramp((Long) rampUpRate).protocolConfig(httpConf)
)

but this still errors:

09:57:35.695 [ERROR] c.e.e.g.a.ZincCompiler$ - /Gatling/user-files/simulations/clients/com/mydomain/www/stress/RecordedSimulation.scala:1088: \sanctuarySpa\com\sanctuaryspa\www\stress\RecordedSimulation.scala:1088:
value rampUpRate is not a member of object Long
10:05:34.915 [ERROR] c.e.e.g.a.ZincCompiler$ - scn1.users(10).ramp((Long) rampUpRate).protocolConfig(httpConf),

Any suggestions why following the documentation, or the explicit cast to long don't work?

Was it helpful?

Solution

Try using rampUpRate.toLong to cast to a Long (or the more general cast rampUpRate.asInstanceOf[Long])

(Long) rampUpRate is seen by the compiler as trying to perform Long.rampUrRate() e.g. applying function rampUpRate to object Long, hence the error message

OTHER TIPS

That's my fault: the wiki page is not up to date. What happens is that you have a java.lang.Integer while the method takes a scala Long. java.lang.Long can be implicitly converted into scala Long, but not java.lang.Integer.

The proper way would be val rampUpRate = java.lang.Long.getLong("ramp", 1L)

PS: I've fixed the doc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top