Looping a Datasource in Groovy script (Always starts at last row)
Hi,
I have been trying to build a datasource loop in Groovy Script. For testing purposes I can't use the DataSourceLoop step.
Below is the case.
I have a Datasource (JDBC) with 4 rows in it and I have build this loop:
TSDS1 = testRunner.testCase.getTestStepByName('DataSource')
for (row in 0..TSDS1.rowCount -1)
{
if (row > 1)
{
testRunner.testCase.getTestStepByName('DataSource').Next
}
log.info TSDS1.getPropertyValue('Field')
}
The problem I have is that CurrentRow of the DataSource is always on the last row.
Is there a way to set te currentRow to the first row in Groovy Script?
Kind Regards
Hi all,
I posted too soon. I figured it out. You can call repositionAtStartRow to reset the source to the first row.
TSDS1.repositionAtStartRow( testRunner, context)