Debugging the session

筅森魡賤 提交于 2019-12-04 17:43:34

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!