Gatling2.0.0 - where did exec go?

Here’s my scenario (feeds are omitted for clarity):

val scn = scenario(name)
.during(180 seconds){

exec(
http(name)
.get("/user/${id}")
.headers(sis_header)
.check(status is 200))
.pause(50 milliseconds)
}

And here are my imports:

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import Headers._

import scala.concurrent.duration._
import bootstrap._

The compiler tells me that it can’t find exec. I’m guessing this worked in earlier versions, but not in Gatling 2. Where did exec go?

Thanks.

I’m no expert but I do know the syntax has changed slightly (noticed the users are defined differently.

In my scripts exec has a leading dot (.exec), try adding one and see if it passes validation then.

Best,

You’re scenario is fine, and my compiler agree.
Which compiler are you talking about? The one shipped with Gatling? An IDE?

That’s what I thought - that it should be fine. I’m using Maven, with the Exilys Repo and plugin configured. I’m running “mvn clean test”. I was using Java 1.6, just upgraded to 1.7 (and mvn 3.0.5) and having the same problem as before.

What’s your compiler error exactly? Which version of Gatling do you use? Have you tried removing the Gatling libs from your local maven repo (might have a corrupted jar somewhere)?

That’s a good idea…i’ll do that and get right back.

Gatling is 2.0.0M2.

Here’s the error:

GetUsers.scala:11: not found: value exec
15:41:36.218 [ERROR] i.g.a.ZincCompiler$ - exec(
15:41:36.219 [ERROR] i.g.a.ZincCompiler$ - ^
15:41:36.524 [ERROR] i.g.a.ZincCompiler$ - one error found
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
Caused by: Compilation failed
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:105)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:155)
at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:97)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:138)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:30)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:28)
at sbt.inc.Incremental$.cycle(Incremental.scala:73)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:33)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:32)
at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:41)
at sbt.inc.Incremental$.compile(Incremental.scala:32)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:25)
at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:146)
at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
at com.typesafe.zinc.Compiler.compile(Compiler.scala:161)
at com.typesafe.zinc.Compiler.compile(Compiler.scala:142)
at io.gatling.app.ZincCompiler$.apply(ZincCompiler.scala:109)
at io.gatling.app.SimulationClassLoader$.fromSourcesDirectory(SimulationClassLoader.scala:31)
at io.gatling.app.Gatling$$anonfun$15.apply(Gatling.scala:177)
at io.gatling.app.Gatling$$anonfun$15.apply(Gatling.scala:177)
at scala.Option.getOrElse(Option.scala:120)
at io.gatling.app.Gatling.io$gatling$app$Gatling$$regularSimulationClassLoading$1(Gatling.scala:177)
at io.gatling.app.Gatling$$anonfun$17.apply(Gatling.scala:186)
at io.gatling.app.Gatling$$anonfun$17.apply(Gatling.scala:186)
at scala.Option.getOrElse(Option.scala:120)
at io.gatling.app.Gatling.start(Gatling.scala:186)
at io.gatling.app.Gatling$.fromMap(Gatling.scala:58)
at io.gatling.app.Gatling$.runGatling(Gatling.scala:79)
at io.gatling.app.Gatling$.main(Gatling.scala:53)
at io.gatling.app.Gatling.main(Gatling.scala)
… 6 more

No luck on cleaning up jars in the maven repository. Any other ideas?

This may be related to the zinc cache, I’ll investigate this we.
Stay tuned!

Nope, I found the problem. User error. Sorry for the distraction.

That’s a good news because I was really puzzled!
Could you share, just so that we’re aware of this mistake and can help future users that might do the same one, please?

It’s embarrassing: I had two similar scenarios - one called GetUser, and another called GetUsers. I had fixed the one (by adding import bootstrap._), but not the other. I wasn’t reading the compiler error closely enough to ensure that I was fixing the right file. Yep, stupidity.

In any case - is there anything special with during? Because, when I finally got the thing working, I got the error below. Changing the “during” to “repeat” got requests generating, but I’d definitely prefer to use “during”.

ava.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won’t be generated
at io.gatling.charts.report.ReportsGenerator$.generateFor(ReportsGenerator.scala:41)
at io.gatling.app.Gatling.generateReports$1(Gatling.scala:156)
at io.gatling.app.Gatling.start(Gatling.scala:209)
at io.gatling.app.Gatling$.fromMap(Gatling.scala:58)
at io.gatling.app.Gatling$.runGatling(Gatling.scala:79)
at io.gatling.app.Gatling$.main(Gatling.scala:53)
at io.gatling.app.Gatling.main(Gatling.scala)
… 6 more

Yep, there’s definitively something special with during in 2.0.0-M2: it broken!
https://github.com/excilys/gatling/issues/1140

It’s fixed in master though, so it will work as expected in 2.0.0-M3 (no date yet).

Sorry for this…

Thanks Stéphane for asking to share the fix and Rick for sharing. The import bootstrap._ fixed my scenario as well.

You’re welcome!