Are there hashMap values ​​for checking JsonPath when using Gatling?

I want to compare some <key,values> in jsonPath passed as HashMap<String,String>() . How can we achieve this by checking gatling?

  val hashMap = new HashMap[String,String]() hashMap.put("foo", "bar") 

OR can I just check something like this?

 for (String key <- keyValue){ .check(jsonPath("$." + key.(is(hashMap.get(key))))) } 

OR

 .check(jsonPath.containsAll(hashMap.keySet), jsonPath.containsAll(hashMap.valueSet)) 

Or I can use hamcrest or some other to compare this HashMap with JsonPath.

 .exec(http("my testl").post("/some_url").headers(common_header).body(bodyPayLoad). asJSON.check(status.is(200)).check(jsonPath("$",Matchers.hasItems(hashMap)).saveAs("response"))).exec(session => { val responseValue = session.get("response").asOption[String] println(testCase + " REST API Response :" + responseValue) session }).pause(10) 

How can I achieve this?

+5
source share

Source: https://habr.com/ru/post/1258914/


All Articles