Run Gatling Test infinitely time (Urgent Please)

Hello Everybody,

I want to use Gatling test as health check API test so like to run Gatline test continuously. Is any way to do that?
Really appreciated.

I tried by adding while loop on setUp but not works

class BasicSimulation extends Simulation {

val httpConf = http
.baseURL(“http://computer-database.gatling.io”) // 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
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)

val scn = scenario(“Scenario Name”) // A scenario is a chain of requests and pauses
.exec(http(“request_1”)
.get("/"))
.pause(7) // Note that Gatling has recorder real time pauses

while(true)
setUp(scn.inject(nothingFor(1 seconds)).protocols(httpConf))
}

Getting Error:

java.lang.UnsupportedOperationException: setUp can only be called once

[error] at io.gatling.core.scenario.Simulation.setUp(Simulation.scala:49)

I also referred https://gatling.io/docs/current/general/simulation_setup/ but no options to run test infinitely time.
Looking for fast response.

Thanks
Anand

setUp(scn.inject(constantUsersPerSec(1) during (10000 hours)).protocols(httpConf)) works but still if you have any other solution let me know.

Have you tried using “forever(){…}”?