def add(a: Int, b:Int) = (a+b).toString
val scn2 = scenario(“My Simple Scenario using repeat loops”)
.during(6) {
feed(csv(“sample_types.csv”).circular)
repeat(26, “latitude”) {
repeat(195, “longitude”) {
exec(http(“getNodeBugSummary”)
.get("/bbproxy/DeliverableProxyServlet/bugsanddrugs")
.queryParam(“action”,“getnodebugsummary”)
.queryParam(“latitude”, (session: Session) => add(“24”.toInt, session.getTypedAttributeString.toInt))
.queryParam(“longitude”,"${longitude}")
.queryParam(“sample”,"${sample}")
)
}
}
}
above code compiles fine, but give error at runtime as below:
22:05:17.747 [GatlingSystem-akka.actor.default-dispatcher-6] ERROR c.e.e.g.h.action.HttpRequestAction - Action HttpRequestAction crashed, forwarding user to next one
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at SimpleScenario$$anonfun$2.apply(SimpleScenario.scala:46) ~[test/:na]
at SimpleScenario$$anonfun$2.apply(SimpleScenario.scala:46) ~[test/:na]
at com.excilys.ebi.gatling.core.session.Session$$anonfun$evaluatableStringToEvaluatableStringSeq$1.apply(Session.scala:49) ~[gatling-core-1.5.2.jar:na]
at com.excilys.ebi.gatling.core.session.Session$$anonfun$evaluatableStringToEvaluatableStringSeq$1.apply(Session.scala:49) ~[gatling-core-1.5.2.jar:na]
at com.excilys.ebi.gatling.http.util.HttpHelper$$anonfun$httpParamsToFluentMap$1.apply(HttpHelper.scala:44) ~[gatling-http-1.5.2.jar:na]
at com.excilys.ebi.gatling.http.util.HttpHelper$$anonfun$httpParamsToFluentMap$1.apply(HttpHelper.scala:44) ~[gatling-http-1.5.2.jar:na]
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233) ~[scala-library-2.9.3.jar:na]
ala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:233) ~[scala-library-2.9.3.jar:na]
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library-2.9.3.jar:na]
at scala.collection.immutable.List.foreach(List.scala:76) ~[scala-library-2.9.3.jar:na]
at scala.collection.TraversableLike$class.map(TraversableLike.scala:233) ~[scala-library-2.9.3.jar:na]
at scala.collection.immutable.List.map(List.scala:76) ~[scala-library-2.9.3.jar:na]
at com.excilys.ebi.gatling.http.util.HttpHelper$.httpParamsToFluentMap(HttpHelper.scala:44) ~[gatling-http-1.5.2.jar:na]
at com.excilys.ebi.gatling.http.request.builder.AbstractHttpRequestBuilder.configureQueryAndCookies(AbstractHttpRequestBuilder.scala:210) ~[gatling-http-1.5.2.jar:na]
at com.excilys.ebi.gatling.http.request.builder.AbstractHttpRequestBuilder.getAHCRequestBuilder(AbstractHttpRequestBuilder.scala:159) ~[gatling-http-1.5.2.jar:na]
at com.excilys.ebi.gatling.http.request.builder.AbstractHttpRequestBuilder.build(AbstractHttpRequestBuilder.scala:173) ~[gatling-http-1.5.2.jar:na]
at com.excilys.ebi.gatling.http.action.HttpRequestAction.execute(HttpRequestAction.scala:62) ~[gatling-http-1.5.2.jar:na]
at com.excilys.ebi.gatling.core.action.Action$$anonfun$receive$1.apply(Action.scala:31) ~[gatling-core-1.5.2.jar:na]
at com.excilys.ebi.gatling.core.action.Action$$anonfun$receive$1.apply(Action.scala:30) ~[gatling-core-1.5.2.jar:na]
at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:76) ~[scala-library-2.9.3.jar:na]
at akka.actor.Actor$class.apply(Actor.scala:318) ~[akka-actor-2.0.4.jar:2.0.4]
at com.excilys.ebi.gatling.http.action.HttpRequestAction.apply(HttpRequestAction.scala:55) ~[gatling-http-1.5.2.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:626) ~[akka-actor-2.0.4.jar:2.0.4]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) ~[akka-actor-2.0.4.jar:2.0.4]
at akka.dispatch.Mailbox.run(Mailbox.scala:179) ~[akka-actor-2.0.4.jar:2.0.4]
at akka.dispatch.ForkJoinExecfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516) [akka-actor-2.0.4.jar:2.0.4]
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259) [akka-actor-2.0.4.jar:2.0.4]
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [akka-actor-2.0.4.jar:2.0.4]
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479) [akka-actor-2.0.4.jar:2.0.4]
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [akka-actor-2.0.4.jar:2.0.4]
22:05:17.784 [GatlingSystem-akka.actor.default-dispatcher-15] WARN c.e.e.gatling.core.session.ELParser$ - Couldn’t resolve EL ${sample}
Along with that looks like session is cleared?
If I define a feeder with this, it works fine:
def coordinateMap = for(lat ← 24 to 50 ; long ← -67 to 125) yield { Map(“latitude” → lat.toString(), “longitude” → long.toString()) };
.feed(coordinateMap.toArray)