Forum Discussion
Hi,
All test cases are depended based on the teststep status code need to run another test cases if any test cases are failed there is no point to add the another testcases.
that's the reason am looking for this solution.
- Bill_In_Irvine7 years agoContributor
I think using Groovy is the likely way to the solution.
I don't have a need to call a request based on the response of a previous request however I can only give some
guide on how I go about it and you can finish the details (because working with Groovy is fun!).The basics of running test cases via Groovy are covered here:
https://support.smartbear.com/readyapi/docs/testing/scripts/samples/cross-project.html
I suppose you can fullfill your goal in a Setup script at the Project level, test suite level or test case level.
I'd go about it by first setting up my test steps, and then get to work with Groovy.You can call a test step based on the information in the above URL. Once you executed that step, you can
get the response. Here is how I get the response, but note I did this in a Groovy Test Step within a test case:import groovy.json.JsonSlurper def previousTestStep = testRunner.getTestCase().getTestStepByName("request1") String propertySpec = '${' + previousTestStep.name + '#Response}' def response = context.expand(propertySpec) def jsonSlurper = new JsonSlurper().parseText(response) // Now suppose your server's response has a name field called status which has a value "Success" or "Fail" def status = jsonSlurper.status if( jsonSlurper.status == "Success") { // call request2 } else { // call request3 }
You can stop the IDE from executing the steps again with testRunner.cancel()
testRunner.cancel("done")
'again, I have not called other requests based on responses as so far I had no need but I hope this helps to give you a guide.
- PaulMS7 years agoSuper Contributor
Do you want to use a script assertion like
https://community.smartbear.com/t5/SoapUI-Pro/Resolved-Get-HTTP-Response-Code/td-p/44019
or Valid HTTP Status Codes Assertion
https://support.smartbear.com/readyapi/docs/testing/assertions/reference/compliance/http-valid.html
with Abort on Error for the Test Case
https://support.smartbear.com/readyapi/docs/soapui/ui/case.html
Related Content
- 7 years agodemosoapuser
- 2 years agoKimdongart1
- 5 years agoskaushik9