I need use assertion like where actual result and expected result should compare
verify the id value into the
.check(jsonPath("$.id").toString.equalsIgnoreCase(“test”)
but this is not working .
could you please tell me that is there any assertion method for this
This code is wrong: you’re transforming to lower case the String representation of the jsonPath check definition, not the result of the check.
You have to use transform.
For example if passed “test1” as id into the request then I want to assert that into response valje is coming or not.
I used the below code but it seems not working.
Kindly suggest me which code I should useAs of now I am using below code
val addNewPet = scenario("Add a new pet to the store")
.feed(Ids)
.feed(csvFeeder)
.exec(
actionBuilder = http("Add a new pet to the store" + baseUrl)
.post(baseUrl + "/v2/pet")
.headers(header1)
.header("test","test")
.body(ElFileBody("jsonfile/AddPet.json"))
.check(status.is(200))
.check(responseTimeInMillis.lte(5000))
.check(jsonPath("$.tags[0].name").find.saveAs("test"))
.check(jsonPath("$.photoUrls[0]").find.saveAs("test1"))
.check(jsonPath("$.photoUrls[1]").find.saveAs("test2"))
.check(checkIf((response: Response, session: Session) => session("test").as[String].transform("${id}"))(substring("${id}")))
)
val addNewPet = scenario("Add a new pet to the store")
.feed(Ids)
.feed(csvFeeder)
.exec(
actionBuilder = http("Add a new pet to the store" + baseUrl)
.post(baseUrl + "/v2/pet")
.headers(header1)
.header("test","test")
.body(ElFileBody("jsonfile/AddPet.json"))
.check(status.is(200))
.check(responseTimeInMillis.lte(5000))
.check(jsonPath("$.tags[0].name").find.saveAs("test"))
.check(jsonPath("$.photoUrls[0]").find.saveAs("test1"))
.check(jsonPath("$.photoUrls[1]").find.saveAs("test2"))
.check(checkIf((response: Response, session: Session) => session("test").as[String].matches("${id}"))(substring("${id}")))
)
I tried above code also
I need to put assertion only where I can verify that whatever value send into the request should be occurred same into the response