Groovy script for executing the next step depending on the previous response parameter
Hi,
I am running a testsuite in readyAPi, I am doing a GET method Request , In GET method response i have response parameter Status, Until the status value is changed to completed i dont want to execute the next test step in the suite. The value of status will be changing after a certain time(there is no fixed time for the status to change to complete since in background some process will be running once those are completed then the status will be changing to complete)
So, in some intervals i have to check whether the status is changed to complete in GET response and accordingly i have to proceed with the next test step execution.
Is this possible with groovy script? if so can you please provide me the script, Since i am new to the scripting.
Thanks
- Hey doubtsreadyapi,
Im not sure if the step supports json...according to the 'help' id say it doesnt. Im not in front of my laptop to check at the moment.
Easiest way to check....add the conditional goto step into a test case immediately after your RESTstep that generates your json response, execute your RESTstep and via the conditional goto step, click on the button in the conditional goto step to try and read the RESTstep's response.
Does it parse the json content ok? If yes you can use the conditional goto step. If it doesnt, you cant use it and youll have to revert to a groovyscript option (@nmrao and @HimanahuTayal may have alternative code to do what you need as im not a coder but they are)
Nice one!
Rich