My use case is to make an http call, get the redirect url from the Location header in the response, and use this url to perform my load testing. This url is dynamically generated and hence the initial first http call. Note that testing the first http call is not part of my test. What is the best way to achieve this ? Is there something like a @BeforeMethod equivalent here in gatling ? Can gatling itself be used to make the standalone http call or do I need to use basic scala to achieve this ? So far I have this :
val httpConfig = http
.inferHtmlResources()
.acceptHeader("*/*")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.header("Authorization", "Negotiate " + token)
.doNotTrackHeader("1")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0")
val scn = scenario("My Tests").exec(http("Health check")
.get("https://example-server.com")
.check(status.is(200)))
setUp(
scn.inject(atOnceUsers(10))
).protocols(httpConfig)
My understanding of gatling and scala is limited. Hence this basic question.