0
votes

I have 2 APIs

  • Create a workflow (http POST request)
  • Check workflow status (http GET request)

I want to performance test on how much time does workflow takes to complete.

Tried two ways:

Option 1 Created a java test that triggers workflow create API and then poll status API to check if status turns to CREATED. I check the time taken in this process which gives me performance results.

Option 2 Was using Gatling to do the same

val createWorkflow = http("create").post("").body(ElFileBody("src/main/resources/weather.json")).asJson.check(status.is(200))
    .check(jsonPath("$.id").saveAs("id"))

  val statusWorkflow = http("status").get("/${id}")
    .check(jsonPath("$.status").saveAs("status")).asJson.check(status.is(200))


  val scn = scenario("CREATING")
    .exec(createWorkflow)
    .repeat(20){exec(statusWorkflow)}

Gatling one didn't really work (or I am doing it in some wrong way). Is there a way in Gatling I can merge multiple requests and do something similar to Option 1

Is there some other tool that can help me out to performance test such scenarios?

1
It sounds like you could utilize Gatling's tryMax feature which allows trying a block N times: gatling.io/docs/current/advanced_tutorial/…Johannes Tuikkala

1 Answers

0
votes

I think something like below should work when using Gatling's tryMax

.tryMax(100) {
  pause(1)
  .exec(http("status").get("/${id}")
    .check(jsonPath("$.status").saveAs("status")).asJson.check(status.is(200))
  )
}

Note: I didn't try this out locally. More information about tryMax: https://medium.com/@vcomposieux/load-testing-gatling-tips-tricks-47e829e5d449 (Polling: waiting for an asynchronous task)

https://gatling.io/docs/current/advanced_tutorial/#step-05-check-and-failure-management