Forum Discussion
- UnhandledContributorI am unaware of a way to do this using the native soapUI interface. However, you could get the same functionality with a Groovy Test Step.
Insert a Groovy Test Step after the test step of which you want to check status.
In the Groovy Test Step, insert something like the following. This script will transfer execution of a test case to an arbitrary test step if the previous test step failed.
def lastResult = testRunner.getResults().last()
def lastResultName = lastResult.getTestStep().getLabel().toString()
def lastResultStatus = lastResult.getStatus().toString()
log.info 'Test Step [' + lastResultName + '] status: ' + lastResultStatus
if( lastResultStatus == 'FAILED' )
{
myGotoStepName = 'Other TestStep Name'
log.info 'Goto step [' + myGotoStepName + ']'
testRunner.gotoStepByName( myGotoStepName )
}
else
{
log.info 'Continue to next step'
}- NileshOccasional Contributor
Hi Unhandled,
I am bit new to SOAP UI,
I have added rest reequest before the groovy script and manually run it and then added groovy script step and
I copied the same code and when try to run it,It shows error
"java.util.NoSuchElementException: Cannot access last() element from an empty list"
Can you suggest what changes or steps to follow to get the Exact status of the teststep.
Thanks
- RadfordSuper Contributor
Are you running the complete test case, allowing the two test steps to be run sequentially? Or are you manually running the REST request test step, and then running the Groovy test step?
I believe that the provided testRunner variable is for the context of the run, thus you have to run the test case to get the results of previous test steps.
"java.util.NoSuchElementException: Cannot access last() element from an empty list" is saying there are no results in the testRunner object.
Related Content
Recent Discussions
- 10 hours ago