Forum Discussion

WMeng's avatar
WMeng
Occasional Contributor
15 years ago

TestRunner returns 0 test step results

Hi Support Team,

I have a test case with test steps in the following order

1) DataSource
2) Request 1
3) Request 2
4) Groovy Script

I need to control the execution of the test steps using the fourth step i.e the groovy script. Below is the script and the log. I can't figure out why the testrunner returns 0 result size after executing the test steps. what am I missing ? By the way I'm using SOAPUI 3.6.1. Appreciate your help.

for( i in 1..2 )
{
//def testStep = testRunner.testCase.testSteps['Request1']
//testStep.run( testRunner, context )
testRunner.runTestStepByName("DataSource")
testRunner.runTestStepByName("Request1")
testRunner.runTestStepByName("Request2")
log.info testRunner.getStatus()
//testRunner.cancel("Stopped")
def results = testRunner.results
log.info( "Found " + results.size() + " TestStepResults.." )

def size = 0;
while( size < results.size() )
{
if( results[size].status.toString() == "FAILED" )
break;
size++
}

// failed?
if( size < results.size() )
{
log.info( "Failure in TestStep " + results[size].testStep.name )
for( msg in results[size].messages )
log.info( msg )
}
else
{
log.info( "No errors occured" )
}

log.info "Time taken" + testRunner.testCase.testSteps["Request1"].testRequest.response.timeTaken
log.info "Time taken" + testRunner.testCase.testSteps["Request1"].testRequest.response.contentLength
log.info "Full Response size (in bytes) " + testRunner.testCase.testSteps["Request1"].testRequest.response.rawResponseData.length

}

Log:

Wed Dec 22 16:04:40 PST 2010:INFO:RUNNING
Wed Dec 22 16:04:40 PST 2010:INFO:Found 0 TestStepResults..
Wed Dec 22 16:04:40 PST 2010:INFO:No errors occured
Wed Dec 22 16:04:40 PST 2010:INFO:Time taken391
Wed Dec 22 16:04:40 PST 2010:INFO:Time taken134273
Wed Dec 22 16:04:40 PST 2010:INFO:Full Response size (in bytes) 134488
Wed Dec 22 16:04:40 PST 2010:INFO:RUNNING
Wed Dec 22 16:04:40 PST 2010:INFO:Found 0 TestStepResults..
Wed Dec 22 16:04:40 PST 2010:INFO:No errors occured
Wed Dec 22 16:04:40 PST 2010:INFO:Time taken106
Wed Dec 22 16:04:40 PST 2010:INFO:Time taken134273
Wed Dec 22 16:04:40 PST 2010:INFO:Full Response size (in bytes) 134488

Thanks,
Srikanth

7 Replies

  • WMeng's avatar
    WMeng
    Occasional Contributor
    Not really. Here is the screen shot.
  • WMeng's avatar
    WMeng
    Occasional Contributor
    Hi Support Team,

    Any update on this? Suggestions are welcome.

    Thanks,
    Srikanth
  • WMeng's avatar
    WMeng
    Occasional Contributor
    Attached is a sample project. Can you please try this on your end and diagnose the problem? I'm still seeing 0 result set for a valid response...

    Thanks,
    Srikanth
  • WMeng's avatar
    WMeng
    Occasional Contributor
    I see that the status of the testRunner is "RUNNING" even after I get the response back from the server and also after executing all the test steps. Is that the reason why the size of testRunner.results is being fetched as '0'. In that case when does the status of the testRunner show "FINISHED"??

    Sorry if I'm not getting this right. But I need to move forward on this quickly. Appreciate your help.

    Thanks,
    Srikanth
  • WMeng's avatar
    WMeng
    Occasional Contributor
    Awaiting your reply.

    Thanks,
    Srikanth
  • WMeng's avatar
    WMeng
    Occasional Contributor
    Figured it out. The script should be run from tear-down. If the script is executed as a test step then one can't monitor the results even if there were test steps above the current step.

    Thanks,
    Srikanth