App is related to an f&b business, I have following scenarios (api calls):
In API call, (2) I extract P1 value using jp@gc Json Extractor and same I did for same call (4). Now as per my expectations, value obtained in both these extractors should be equal as order has been cancelled now.
To assert these values, I am using JSON Assertion , either I am making use of wrong assertion or lacking a big amount of information here.
May be there is something like I can save the value first in some variable, and then assert.
You can add JSR223 Assertion with checking different variables e.g. a
and b
:
if (!vars.get("a").equals(vars.get("b"))) {
AssertionResult.setFailureMessage("message");
AssertionResult.setFailure(true);
}
The script can check various aspects of the SampleResult. If an error is detected, the script should use AssertionResult.setFailureMessage("message") and AssertionResult.setFailure(true)