How to get the number of users in a simulation?


I’m working with Gatling to record its test runs to a database and as part of that include the number of users in the run.

Ideally the write to the database is performed in the after hook of a Simulation.

Is there a way to pull the number of users in a Simulation from within the after hook?

For example, I’m imagining something like:

class BasicSimulation extends Simulation {

after {

val httpConf = http // 4
.baseURL(“”) // 5
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”) // 6
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0”)

val scn = scenario(“BasicSimulation”) // 7
.exec(http(“request_1”) // 8
.get("/")) // 9
.pause(5) // 10

setUp(scn.inject(rampUsers(1000) over (1 minutes)).protocols(httpProtocol))


Is this possible? or is there a better way to do it?

Should I just make a val somewhere else in the class and put the users in there instead?

Steve Opalenski