Forum Discussion
While I would not want to say this is the best way, I do something similar to what you are asking. I do the following:
- Make Initial Call
- Delay Step
- Make Status Check Call (has the async call completed?)
- Groovy TestStep with code to check the output from step 3 and if the async call is not completed/as expected, go back to the delay step and repeat. I also put in a max retry limit to stop things from getting stuck into an infinite loop should something go wrong.
- Validate results are as expected.
You can then tweak the delay time and the amount of retrys to suit you situation.
In real world cases I usually put steps 2,3 & 4 into a separate "common library" test case thus keeping the actual test case a bit cleaner and making the steps to check reusable (as I usually find I'll want to make multiple step 1 "Make Initial Call" with subtly different inputs, that just need slightly different validations in step 5).
- kenm9 years agoContributor
Thanks Radford!
That would work perfectly in my context, my Groovy skills are on the novice side at present.Don't suppose you'd be able to share your script/a sanitised version to give me a step up? Appreciate it.
Ken
- Radford9 years agoSuper Contributor
While I don't have scripts I can share easily at hand, there are a couple of things I can point out with regard to interacting with Ready API to help you on your way.
Firstly have you seen Groovy script Get Data functionality? This will allow you to get data from a previous step using the GUI. This will help you learn the corrrect syntax.
Secondly, you'll see that Groovy test steps provide the script with among others a variable called testRunner this provides several methods of interest to you:
testRunner.gotoStepByName("Test Case Name")
This will allow you to transfer execution to another named test step within the current test case, and
testRunner.fail("Insert your fail reason here.")
This will allow you fail a test for whatever reason you chose, for example if you've reached your self defined retry limit.
Note: If you're just beginning with Groovy scripting, perhaps someone else may be able to offer a better non-Groovy alternative to your question.
- kenm9 years agoContributor
Thanks Radford! Appreciate your time... just doing some experimentation at the moment and hopefully will have it sorted reasonably quickly. I've a lot of historical scripting experience so shouldn't be too alien.
Cheers for flagging the get.data and testrunner object... really appreciate your time!
Once I get something simple nailed down I'll prob post a reply here that will hopefully help someone else out down the line.
Related Content
- 6 years ago
- 14 years ago
Recent Discussions
- 24 days ago