Forum Discussion
LK,
you can either use the Conditional Goto Test step or Groovy scripting.
There's a comprehensive article on controlling the test case flow using both these approaches in SoapUI/ReadyAPI docs.
Best regards,
Karel
- LK3 years agoNew Contributor
Hi Karel, thanks for your reply. I tried using groovy script and I am getting this error- groovy.lang.MissingPropertyException: No such property: java for class: Script4
error at line: 7Scrpit:
import groovy.json.JsonSlurper
//def loopProperties = testRunner.runTestStepByName("REST Request")
//def count =Integer.parseInt (testRunner.testCase.testSuite.getPropertyValue( "availableEvStationCount" ))
def availableEvStationCount= testRunner.testCase.getPropertyValue( java.lang.string("availableEvStationCount") )
testRunner.testCase.setPropertyValue("availableEvStationCount", "availableEvStationCount" )
//Integer count = scount as Integer
if (availableEvStationCount<2)
{
Thread.sleep(5000)
} else {
testRunner.runTestStepByName("REST Request")
}Could you please help.
- KarelHusa3 years agoChampion Level 1
LK,
you can:
- call your API
- save the result into a property
- execute the Groovy script
See the screenshot below.
In the Groovy script, I would suggest utilizing testRunner.gotoStepByName( "RESTRequest"):
// The result is saved in a property value as string, transform into an integer
def result = Integer.parseInt(testRunner.testCase.getPropertyValue("result"))
if (result < 50) {
sleep(1000)
testRunner.gotoStepByName("RESTRequest")
}If the result is 50 or higher, the loop is finished, and your test case continues.
Best regards,
Karel
Related Content
- 10 years ago
- 10 months ago
- 5 years ago
Recent Discussions
- 2 hours ago
- 17 days ago