Forum Discussion
ashkht
I am trying to follow the flow you have and I'm not sure why you would want to add the row number to a list. It looks like you are looping inside your script loop. Unless I am totally misunderstanding what you are trying to accomplish my input would be to write out to a file with the current row number and any additional parameters to would like to include. It looks like you are using "failDetails1.html" for something so here is what I would suggest.
import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus
def TestCase = testRunner.getTestCase()
def StepList = TestCase.getTestStepList()
def row = testRunner.testCase.testSteps["DataSource"].currentRow
def failDetails=new File("C:/folder/failDetails1.html") //failed being written to
StepList.each{
if(it.metaClass.hasProperty(it,'assertionStatus')){
if(it.assertionStatus == AssertionStatus.FAILED){
testRunner.testCase.setPropertyValue("Result", "Fail" )
failDetails.append row + ' row failed' + '<br>' //append the results
log.info "${it.name} FAIL"
}else if(it.assertionStatus == AssertionStatus.VALID){
testRunner.testCase.setPropertyValue("Result", "Pass" )
log.info "${it.name} OK"
}else if(it.assertionStatus == AssertionStatus.UNKNOWN){
log.info "${it.name} UNKNOWN (PROBABLY NOT ALREADY EXECUTED)"
}
}
}
Hello bagochips
Thanks for your response!
I am trying to save data row # to a list for failed test cases, since i have written a Tear down script at Test Suite level,
to capture messages for failed test steps across all test cases from a test suite.
Then, i am publishing captured failed test step messages under Log details section of HTML report generated from test suite level. But i am stuck at one thing, wherein i wanted to print Data row # for corresponding failed test step messages so that it can be segregated and can give more clarity to logs section.
During this course of generating HTML report, found below issues due to which i have come up with this approach:
1. SOAP UI provides Data Row # as a message at end of each test data row execution and it is independent of failed test steps, due to which i am unable to capture this message even if i add boolean condition to check test step status = 'FAILED' at tear down script.
2. The below groovy statement, is only supported at test case level and not at test suite since 'runner' class doesn't support
below statement or methods.
def row = testRunner.testCase.testSteps["DataSource"].currentRow
PFA Tear down script written at test suite level - capturing messages for failed test steps and also snippet of HTML report and SOAPUI test case structure.
Appreciate your help on the same.
Regards,
Ashish