Please check this pinned post: How to Ask a Question - #2
We ask that you provide a reproducer for very good reasons:
- it saves time for the people willing to help you
- the issue might be something completely different from your guess
We also ask that you test with the latest Gatling version:
- your issue might have been already fixed
I’ve done a reproducer of the setup you’ve described and it works just fine:
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class DoWhileDuringSim extends Simulation {
val httpProtocol = http
.baseUrl("https://github.com") // Here is the root for all relative URLs
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // Here are the common headers
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
val scn = scenario("Scenario")
.doWhileDuring(_ => true, 3.seconds) {
exec(http("InLoop").get("/gatling/gatling"))
.pause(1)
}.exec(http("AfterLoop").get("/gatling/gatling"))
setUp(scn.inject(atOnceUsers(1)).protocols(httpProtocol))
}
================================================================================
2022-03-20 08:27:03 3s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=4 KO=0 )
> InLoop (OK=3 KO=0 )
> AfterLoop (OK=1 KO=0 )
---- Scenario ------------------------------------------------------------------
[##########################################################################]100%
waiting: 0 / active: 0 / done: 1
================================================================================