cancel
Showing results for 
Search instead for 
Did you mean: 

teststep status

Highlighted
Contributor

teststep status

I made a calling testcase that I'm using to prompt some values and to run the other testcases in my testsuite; at the end of the calling testcase, I'm prompting the run status with this teardown script.
How can I retrieve the status of the called testcases (I need OK/Failed, not the details) ?  I can get the calling testcase status but not the ones from the 'run testcase' steps (these are step3 & 4 in my calling testcase).

My prompt shows correctly:
testcase = the calling test case name, steps = the 2 run testcases names, the calling testcase status
and what I cannot get: step3 = class com.eviware.soapui.model.testsuite.teststepresult$teststepstatus

Thanks for help,
Philippe.

import com.eviware.soapui.SoapUI;
import com.eviware.soapui.model.testsuite.TestRunContext;
import com.eviware.soapui.model.testsuite.TestRunner;
import com.eviware.soapui.model.testsuite.TestRunner.Status
import com.eviware.soapui.model.testsuite.TestStepResult;
 
def testcase = testRunner.getTestCase();
def steplist = testcase.getTestStepList() ;
def a3 = steplist[3];
def step_a3 = com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus;

def a4 = steplist[4];
// possible values = def step_a3 = com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus.values();

def teststatus = testRunner.getStatus();

com.eviware.soapui.support.UISupport.showInfoMessage(
  "testcase = " + testcase.name + "\n"
  + "steps = " + a3.name + "  +  " +  a4.name  + "\n"
   + " --> " + "testcase status = " + teststatus + "\n"
   + "step3 = " + step_a3 + "\n"
  );
4 REPLIES 4
Highlighted
Super Contributor

Re: teststep status

Hi,

the status property of the corresponding TestStepResult for your Run TestCase TestStep will mirror the status of the executed TestCase; get the TestStepResult via the testRunner.results property.

regards!

/Ole
eviware.com
Highlighted
Contributor

Re: teststep status

Hi

the mirror status, that works fine.
but as I have multiple runtestcase steps I'd need the status of each runtestcase and I don't find the way to retrieve that info, testRunner.results returns me empty string.

philippe.
Highlighted
Super Contributor

Re: teststep status

Hi!

testRunner.results returns a list containing all TestStepResults currently created for the execution of the TestCase, so if your last three steps were Run TestCase steps, the last three entrees in this list should correspond to the execution and status of these TestCases. Try the following to get an idea;

for( r in testRunner.results )
  log.info( "TestStep " + r.testStep.name + " finished with status " + r.status )

regards!

/Ole
eviware.com
Highlighted
Contributor

Re: teststep status

Great.
Thanks, Philippe.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors