0

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
      }

    }
user2313658
  • 41
  • 1
  • 2
  • 7
  • Why don't you just start a timer in the beginning of the program, and then read how many seconds have passed when it ends? You can use a library like JodaTime to get the current time and date. – Electric Coffee Jun 28 '14 at 11:55

1 Answers1

0

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.

Stephane Landelle
  • 6,990
  • 2
  • 23
  • 29