As part of my performance testing, I need to debug the session etc. The same code is running if I remove session =>
. When I add that it says there was no request sent during simulation since it is not sending any.
val scn1 = scenario("LaunchAction").exec{ session =>
http("Poll report status page report")
.get("myURL/rest/reports")
.queryParam("applicationId", "123")
.queryParam("id", "1")
.check(xpath("//status").saveAs("responseStatus"))
session
}
I need to add few prints etc in between. Can you please provide some information?
I just started with Gatling and I had exactly the same problem.
The easiest way to debug for me was the addition of the entrypoint object, which I use to start/debug tests locally by running the main method
object DebugEntrypoint {
def main(args: Array[String]) {
// This sets the class for the Simulation we want to run.
val simClass = classOf[Smoke].getName
val props = new GatlingPropertiesBuilder
props.sourcesDirectory("./src/test/scala")
props.binariesDirectory("./target/scala-2.10/classes")
props.simulationClass(simClass)
Gatling.fromMap(props.build)
}
}
As soon as the test is being executed from here, any breakpoints I put in the simulation will pause execution during the runtime. As soon as you hit a breakpoint, you can evaluate expressions and have all other debug instruments at your bidding.
You can add another exec to it like this:
.exec(
session => {
val activityId = session.get("someId").asOption[String]
println(activityId)
session
}
)
This should give you the session details.
one more thing you can do for the debug purpose in conf folder of Gatling
there would be one file logback.xml in which you had to uncomment the two lines
after uncommenting these lines you would get every request while running in browser in detailed way which will help you in order to solve the query