I want to use the one api's result into another api in karate-gatling. Both api's are being simulated in gatling

Viewed 142

I have a GET api which returns some data, I need to use that data in POST api on which I am supposed to simulate load testing for continuously over a period of time.

I am able to corelate those api, but when I do load testing it is simulated on both the apis. I want to do load testing only on post api. How can I do that?

1 Answers

You should be able to define 2 Gatling scenarios and do this. So please read the documentation.

And in the latest version of Karate you should be able to pass data from 2 different feature files in 2 different Gatling scenarios. Please see the docs here: https://github.com/intuit/karate/tree/master/karate-gatling#chaining

Something like this:

val chained = scenario("chained")
   .exec(first)
   .exec(karateSet("extraKey", s => "extraValue"))
   .exec(second)

You can find a complete example here: TestSimulation.scala

So now you should be able to figure out how to use the Gatling syntax so that the first Gatling scenario is executed only once. This answer is an example: https://stackoverflow.com/a/60116256/143475

Related