KMR
11 years agoOccasional Contributor
Test step and assertion status using testRunner.results
I am trying the below code to get the status of the test step and assertions in the soapUi test case.
In the test case I am doing a loop so that the same request gets executed with multiple sets of data.
The issue I am facing is that for each iteration of the step result , assertion status and error message of the last instance of the step is returned.
Due to this I am not able to find out if the step passed in a particular iteration or not.
Is this an issue with soapUi ?
attached project has a very simplified version of what I am trying to implement)
Log out put is below . For the first three lines I was expecting the assertion status to be Valid.
In the response that I got assertion passed, but it looks like the status from the last iteration of the step is being returned in the code.
Wed Sep 25 14:27:59 PDT 2013:INFO:TestStep [ GetInfoByZIP ] finished with status OK
Wed Sep 25 14:27:59 PDT 2013:INFO:Assertion [Citi Name Match] has status [FAILED] -- [Kalesh] This is not correct. For this instance the Assertion was a success.
Wed Sep 25 14:27:59 PDT 2013:INFO:-> Error [Missing token [Bellevue] in Response]
Wed Sep 25 14:27:59 PDT 2013:INFO:TestStep [ GetInfoByZIP ] finished with status FAILED
Wed Sep 25 14:27:59 PDT 2013:INFO:Assertion [Citi Name Match] has status [FAILED]
Wed Sep 25 14:27:59 PDT 2013:INFO:-> Error [Missing token [Bellevue] in Response]
I am using soapUi version 4.6.0 (Same is the behavious in 4.5.2 as well)
Note :
Instead of using testRunner.results , if I use testRunner.testCase.testSteps["stepname"] with in the loop , I am able to get the details correctly.
But I would prefer to use testRunner.results outside the loop if it gives me the correct output
In the test case I am doing a loop so that the same request gets executed with multiple sets of data.
The issue I am facing is that for each iteration of the step result , assertion status and error message of the last instance of the step is returned.
Due to this I am not able to find out if the step passed in a particular iteration or not.
Is this an issue with soapUi ?
attached project has a very simplified version of what I am trying to implement)
for( r in testRunner.results )
{
if ( r.testStep instanceof com.eviware.soapui.model.testsuite.Assertable)
{
log.info "TestStep [ " + r.testStep.name + " ] finished with status " + r.status
for( assertion in r.testStep.assertionList )
{
log.info "Assertion [" + assertion.label + "] has status [" + assertion.status + "]"
for( e in assertion.errors )
log.info "-> Error [" + e.message + "]"
}
//log.info r.testStep.testRequest.response.contentAsString
}
}
Log out put is below . For the first three lines I was expecting the assertion status to be Valid.
In the response that I got assertion passed, but it looks like the status from the last iteration of the step is being returned in the code.
Wed Sep 25 14:27:59 PDT 2013:INFO:TestStep [ GetInfoByZIP ] finished with status OK
Wed Sep 25 14:27:59 PDT 2013:INFO:Assertion [Citi Name Match] has status [FAILED] -- [Kalesh] This is not correct. For this instance the Assertion was a success.
Wed Sep 25 14:27:59 PDT 2013:INFO:-> Error [Missing token [Bellevue] in Response]
Wed Sep 25 14:27:59 PDT 2013:INFO:TestStep [ GetInfoByZIP ] finished with status FAILED
Wed Sep 25 14:27:59 PDT 2013:INFO:Assertion [Citi Name Match] has status [FAILED]
Wed Sep 25 14:27:59 PDT 2013:INFO:-> Error [Missing token [Bellevue] in Response]
I am using soapUi version 4.6.0 (Same is the behavious in 4.5.2 as well)
Note :
Instead of using testRunner.results , if I use testRunner.testCase.testSteps["stepname"] with in the loop , I am able to get the details correctly.
But I would prefer to use testRunner.results outside the loop if it gives me the correct output