I have some code in my scenario such as
.check(status.is(200), jsonPath("$['resultData'][*]['@contentType']").findAll.saveAs("resultData"))
.check(status.is(500), jsonPath("$['processingError']").find.saveAs("processingError"))
but I keep getting the following
10:36:51.946 [WARN ] i.g.h.a.ResponseProcessor - Request 'GetAllThings' failed: status.find.is(200), but actually found 500
10:36:52.344 [WARN ] i.g.h.a.ResponseProcessor - Request 'GetAllThings' failed: status.find.is(500), but actually found 200
Is there some way I can construct my checks so that I don't get these messages, because I am already handling both cases?
I have tried several variations, but nothing seems to work.
Okay, this does what I want (mostly)
.check(
status.in(Seq(200, 400, 500)),
jsonPath("$['resultData'][*]").findAll.optional.saveAs("resultData"),
jsonPath("$['processingError']").optional.saveAs("processingError")
)
I say mostly because while it solves one problem, it creates another. Basically the 400 and 500 errors are captured, but now they are not marked as KO, so the statistics don't count them. I tried explicitly returning
sesson.markAsFailed
in my exec(), but that does not work, probably because once you are out of the check, the failure does not count (pun intended).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.