Skip to content

Instantly share code, notes, and snippets.

@maiha
Created September 5, 2014 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maiha/73f8aff2abb403cc4dae to your computer and use it in GitHub Desktop.
Save maiha/73f8aff2abb403cc4dae to your computer and use it in GitHub Desktop.
gatling-inspect-session
package study
/** gatling-2.0.0-RC3
* @example{
* ./bin/gatling.sh -nr -s study.InspectSession
* }
*/
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.core.validation.Success
class InspectSession extends Simulation {
val httpProtocol = http.baseURL("http://localhost")
.inferHtmlResources()
val scn = scenario("inspect session")
.exec(http("Home").get("/"))
.exec(session => {
println(s"session=${session}")
Success[Session](session) // need for validation
})
setUp(scn.inject(rampUsers(1) over(1)).protocols(httpProtocol))
}
@slandelle
Copy link

Actually, you don't even need to wrap explicitly the session in a Success, there's an implicit that would do it automatically for you.

You can just write:

exec(session => {
      println(s"session=${session}")
     session
    })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment