Hi,
I guess a simple(?) question:
the response check in below post will always succeed, i.e. session result “OK”, as any webServiceError value string ending with “}” will be accepted.
But if I want to set result “KO” if “webServiceError” != “null” - how can it be implemented??
OK: “webServiceError”:null}
KO: “webServiceError”:{"some application error description… "}
.exec(http(“scn008_request_8”)
.post("""/xxxxxx/xxxxxx/xxxxxx""")
.headers(headers_1)
.body(ELFileBody(“scn003_request_8.txt”))
.check(regex("""“webServiceError”:(.*(?=}))""")
.find.saveAs(“webServiceError”)))
rgds Juha
…some additional info:
tried also following, but didn’t seem to bite, not sure what this .markAsFailed really does, couldn’t find much by googling.
.doIf(session => session(“webServiceError”).as[String] != “null”) {exec(chain_applerror).exec(session => session.markAsFailed)}
/rgds Juha
Thanks for your comments Stephane.
I had a look at the links you provided: I’m afraid it’s a bit out of my league to modify/implement this thing (changing “OK” to “KO” in a session, after additional value checks).
I can live with current situation, and just generate session data printout whenever a specific response value is considered as faulty.
Still, wondering what is the true purpose and functionality of exec(session => session.markAsFailed).
If a session actually can be set to “failed” like this - why is it recorded as “OK” in stats? I can see clear use of this feature if the session result would change to “KO” as well.
But I’m still a newbe here, and have this awkward feeling that I’m misunderstanding something here…?
rgds Juha
Thanks for your comments Stephane.
I had a look at the links you provided: I'm afraid it's a bit out of my
league to modify/implement this thing (changing "OK" to "KO" in a session,
after additional value checks).
I can live with current situation, and just generate session data printout
whenever a specific response value is considered as faulty.
Implementing this will be easier with upcoming version/current snapshot.
Still, wondering what is the true purpose and functionality of exec(session
=> session.markAsFailed).
If a session actually can be set to "failed" like this - why is it
recorded as "OK" in stats? I can see clear use of this feature if the
session result would change to "KO" as well.
But I'm still a newbe here, and have this awkward feeling that I'm
misunderstanding something here...?
markAsFailed is what's being used to control exitHereIfFailed:
failing checks set markAsFailed, not the other way around.