Gatling: Scala: Can multiple json check be in single check in a session???

I am new in scala programming, please consider the scenario…

.exec(http("request_7")
.post("/test/listing")
.headers(headers_12)
.formParam("abcId", "${abcID}")
.formParam("action_id", "100")
.formParam("controller", "/test/listing")
.check(jsonPath("$.data[*].xyzId").findAll.saveAs("xyzID"))
.check(jsonPath("$.data[*].abcNo").findAll.saveAs("ABCNo"))
.check(jsonPath("$.data[*].revId").findAll.saveAs("revID"))
.check(jsonPath("$.data[*].dTypeId").findAll.saveAs("dTypeID")))
``

In this request, I have to implement multiple check(s) to get the value. It is manual procedure. Is there any method in scala to perform this scenario in single check?
In other words, I want to get these values in single json check. Is it possible???

So can anyone tell me what is the method to implement this scenario???

Your help would be much appreciated.

Thanks,

Praveen Mourya

As I understand it, each call of .check will overwrite the previous one. From your code, I’d expect that the only thing being saved is the last one: dTypeID - is that what you are seeing? You should combine all of them in one call to .check, perhaps like:

    .check(
      jsonPath("$.data[*].xyzId").findAll.saveAs("xyzID"),
      jsonPath("$.data[*].abcNo").findAll.saveAs("ABCNo"),
      jsonPath("$.data[*].revId").findAll.saveAs("revID"),
      jsonPath("$.data[*].dTypeId").findAll.saveAs("dTypeID")
    )

Perhaps the docs will be helpful: http://gatling.io/docs/2.2.2/http/http_check.html?highlight=multiple%20checks

Thanks very much Daniel,
It is working for me…:slight_smile: