admin管理员组文章数量:1313816
I have a scenario where I am preparing the request for a user and then hitting 2 endpoints with the same request
val scenario9 = scenario("All end points")
.feed(feeder)
.exec(session => {
val uniqueId = session("uniqueId").as[Int]
val startIdx = Math.min(30 * (uniqueId - 1) + 0, 49951)
val endIdx = Math.min(startIdx + 30 + 0, 49951)
val dynamicArray = fullarray.slice(startIdx, endIdx)
.map(elm => s""""$elm"""")
.mkString("[", ",", "]")
session.set("requestArray", dynamicArray)
})
.exec(http("test1" )
.post("/endpoint1")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
.exec(http("test2" )
.post("/endpoint2")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
If I do this, endpoint1 gets called and then endpoint2 isn't called until I get the response from endpoint1. I need to call these 2 endpoints parallely. I've tried using .resources but it doesn't work.
val scenario9 = scenario("All end points")
.feed(feeder)
.exec(session => {
val uniqueId = session("uniqueId").as[Int]
val startIdx = Math.min(30 * (uniqueId - 1) + 0, 49951)
val endIdx = Math.min(startIdx + 30 + 0, 49951)
val dynamicArray = fullarray.slice(startIdx, endIdx)
.map(elm => s""""$elm"""")
.mkString("[", ",", "]")
session.set("requestArray", dynamicArray)
})
.resources(
http("test1" )
.post("/endpoint1")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200)),
http("test2" )
.post("/endpoint2")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
Anything else that I could try?
I have a scenario where I am preparing the request for a user and then hitting 2 endpoints with the same request
val scenario9 = scenario("All end points")
.feed(feeder)
.exec(session => {
val uniqueId = session("uniqueId").as[Int]
val startIdx = Math.min(30 * (uniqueId - 1) + 0, 49951)
val endIdx = Math.min(startIdx + 30 + 0, 49951)
val dynamicArray = fullarray.slice(startIdx, endIdx)
.map(elm => s""""$elm"""")
.mkString("[", ",", "]")
session.set("requestArray", dynamicArray)
})
.exec(http("test1" )
.post("/endpoint1")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
.exec(http("test2" )
.post("/endpoint2")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
If I do this, endpoint1 gets called and then endpoint2 isn't called until I get the response from endpoint1. I need to call these 2 endpoints parallely. I've tried using .resources but it doesn't work.
val scenario9 = scenario("All end points")
.feed(feeder)
.exec(session => {
val uniqueId = session("uniqueId").as[Int]
val startIdx = Math.min(30 * (uniqueId - 1) + 0, 49951)
val endIdx = Math.min(startIdx + 30 + 0, 49951)
val dynamicArray = fullarray.slice(startIdx, endIdx)
.map(elm => s""""$elm"""")
.mkString("[", ",", "]")
session.set("requestArray", dynamicArray)
})
.resources(
http("test1" )
.post("/endpoint1")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200)),
http("test2" )
.post("/endpoint2")
.body(ElFileBody("./performance/resources/Req1.json")).asJson
.check(status.in(200))
)
Anything else that I could try?
Share Improve this question edited Jan 30 at 16:08 Sarthak asked Jan 30 at 15:40 SarthakSarthak 632 silver badges10 bronze badges1 Answer
Reset to default 0"resources" can only be used as a child of a parent HTTP request.
What you're looking for is not supported yet, see https://github/gatling/gatling/issues/3783
本文标签: Parallel http calls in same gatling scenarioStack Overflow
版权声明:本文标题:Parallel http calls in same gatling scenario - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741954961a2406934.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论