Conditional goto
I dont have any experience with the Conditional goto step.
When I try to "run the current condition against the previous responce" I get: "Condition not true for current response in [Product_Details]"
my condition is:
exists(//id)
[Product_Details] JSON responce starts off as:
{ "id":"...So I think "//id" should exist.
When I run the test, the log for the Conditional goto displays:
Tue Oct 20 14:37:29 CEST 2015: Missing matching condition, moving on.
Am I missing something?
Thanks,
Teak
- Hi again Teak, - Its not a direct answer to the issue with the conditional goto TestStep (not sure how well they work with JSON), but since you are doing well with your Groovy, I thought I'd suggest a Groovy alternative that I personally find more flexible: - import static com.jayway.jsonpath.JsonPath.parse def response = context.expand( '${REST Request#Response}' ) def id = parse(response).read('$.id') log.info id if (id!=null) testRunner.gotoStepByName("TestStepName")- So, instead of teh Conditional Goto TestStep, if you instead create a Groovy TestStep after your Request TestStep, then the above code shows how you could: - 1) Get the response JSON from (in this case) a REST Request TestStep called REST Request. - 2) Parse the JSON response using JSONPath - 3) Test the value of id from the JSON document, and use the programatic equivalent of conditional goto. - Hope this helps, - Cheers, - Rupert