How to achieve parallel https requests within same scenario?

99 views
Skip to first unread message

Vikram Verma

unread,
Feb 13, 2019, 1:07:17 AM2/13/19
to Gatling User Group
I am trying to figure out a way where I can have multiple http requests execution concurrently within the same scenario. For example:in the following script, I wan to execute request 0 and request 1 to be executed in parallel for every user.



package computerdatabase


import io.gatling.core.Predef._
import io.gatling.http.Predef._


class Vik123 extends Simulation {


    val httpProtocol
= http
       
.baseUrl("http://abc.com")
       
       
.acceptEncodingHeader("""gzip, deflate""")
       
.acceptLanguageHeader("""fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3""")
       
.userAgentHeader("""Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0""")


    val headers_0
= Map("""Accept""" -> """text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8""")


    val scn
= scenario("Scen1")
       
.exec(http("request_0")
           
.get("""/""")
           
.headers(headers_0)
           
.resources(http("request_1")
           
.get("""/""")
           
.headers(headers_0)))
               
.pause(10)


    setUp
(scn.inject(atOnceUsers(10))).protocols(httpProtocol)
}

Wilmar Muñoz

unread,
Feb 18, 2020, 1:21:36 AM2/18/20
to Gatling User Group
This is exactly what .resources does, take a look to https://gatling.io/docs/current/http/http_request/#resources

Reply all
Reply to author
Forward
0 new messages