How to get current data row# from DataSource TestStep into list using groovy script
Hello,
I am trying to fetch current data row # from DataSource (containing different test data - test data driven concept) TestStep using groovy script TestStep and then add it to list. But i am facing an issue wherein, if there are multiple test failures - while adding data row# to list, only last failed data row is been saved in list by overriding previous data row#.
Tool used: Ready API 1.9.0
Please find groovy script below which i have tried:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def projPath = groovyUtils.projectPath
def reportId = context.expand( '${DataSource#Report ID}' )
def desc = context.expand( '${DataSource#TC Description}' )
def row = testRunner.testCase.testSteps["DataSource"].currentRow
def testStepcount=testRunner.testCase.getTestStepCount();
def testsuitename=testRunner.testCase.testSuite.getName()
def testcase = testRunner.testCase.getName()
def rowStatus=[]
def Status='OK'
def dataRowList = []
def failDetails1=new File(projPath+"/SoapUIResults/"+testsuitename+"/"+"failDetails1.html")
log.info testStepcount
for(i=1;i<=(testStepcount-1);i++)
{
rowStatus[i]=context.expand( '${=testRunner.results[testRunner.results.size()-'+i+'].status}')
if(rowStatus[i]=='FAILED')
{
Status='FAILED'
dataRowList.add(row)
}
}
Also, please find attached SOAP UI testcase to know structure of test case.
Can you please assist me on the same.
Regards,
Ashish