1

I am performing a load test with karate Gatling. As per my requirement, I need to create the booking and use the bookingId from the response and need to pass it to the update/cancel the booking request.

I have tried with below process:

In the test.feature file:

  • def createBooking = call read('createBooking')

  • def updateBooking = call read('updateBooking') { bookingid: createBooking.response.bookingId }

I am trying to apply 1000 ramp users at a time.

In the ghatling simulation file: val testReq = scenario("testing").exec(karateFeature("classpath:test.feature"))

setUp( testReq.inject(rampUsers(1000).during(1 seconds)) )

This process is unable to provide me the required throughPut. I am unable to find the bottleneck whether there is a problem with the karate or API server. In each scenario, we have both create and update bookings, so I am trying to capture all the 1000 bookings ids from the response during the load test and pass it to the update/cancel bookings. I will save it to a file and utilize the booking response for updating a booking. As I am new to Karate, can anyone suggest a way to store all the load test API responses to a file?

Dilleswar
  • 63
  • 4

1 Answers1

1

The 1.0 RC version has better support for passing data across feature files, refer this: https://github.com/intuit/karate/issues/1368

so in the scala code you should be able to do something like this:

session("myVarName").as[String]

And to get the RC version, see: https://github.com/intuit/karate/wiki/1.0-upgrade-guide

That said - please be aware that getting complex data-driven tests to work as a performance test is not easy, so yes - you will need to do some research. My suggestion is read and understand the info in the first link in this answer.

Writing to file is absolutely NOT recommended during a performance test. If you really want to go down that route, please read this: https://stackoverflow.com/a/54593057/143475

Finally if you are still stuck, please follow the instructions here: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • I have gone through the above solutions, Can we able to capture the response from the feature file back to the Gatling simulation? I am using karate 0.9.6 and Gatling 3.0.2. I have found one commit which is useful for me: https://github.com/intuit/karate/commit/3b0ad237211ec4d769cfb2b4cc318c1d23c5102c But to utilse this in my maven project, what I have to change in my dependencies? – Dilleswar Mar 03 '21 at 15:51
  • @Dilleswar please read this: https://github.com/intuit/karate/wiki/1.0-upgrade-guide - it takes research, be patient. else assume this is not supported and be open to using other solutions – Peter Thomas Mar 03 '21 at 17:10
  • 0.9.9.RC4 version released on Feb 9th, 2021. Seems 1.0 RC is not yet released. can I use session("myVarName").as[String] in 0.9.9.RC4 to fetch the karate variables to gatling simulation? – Dilleswar Mar 08 '21 at 11:21
  • 1
    @Dilleswar the answer is yes – Peter Thomas Mar 08 '21 at 11:23