I need to implement a time counter that counts the number of seconds that have passed once program has entered .during. Then if the counter value has met or exceeded a set number of seconds, the function within the doIf will execute. Time counter will then automatically be reset and restarted the end of the doIF.
This is what I have so far.
.repeat( roundsPerSession ) {
exec( Storage.insert.prompt)
.during( sessionLength ) {
exec( Storage.insert.postEvent1 )
.pause( interval second )
.doIf(counter >= sessionLength){
exec(Storage.insert.postEventSummary)
//resetcounter
}
}
Gatling stores in the virtual user's session the timestamp of the moment it entered the during loop.
The timestamp attribute name depends on Gatling version. With current version, this is "timestamp." + .
By default, counterName is a random UUID, but you can pass your own value too: https://github.com/excilys/gatling/wiki/Structure-Elements#during.