Forum Discussion

samtest's avatar
samtest
Regular Visitor
7 years ago

.repositionAtStartRow(testRunner,context) does not work

Hi,

 

I am trying to loop through a set of data, using datasource-excel via groovy scripting.

I am able to loop through successfully. However, my loop always starts at the last row.

I am not sure where I am going wrong.

 

Here is the Code:

 

context.testCase.getTestStepByName("PNRDataSource").setStartRow("0")
context.testCase.getTestStepByName("PNRDataSource").repositionAtStartRow( testRunner, context)
currentRow = context.testCase.getTestStepByName("PNRDataSource").getCurrentRow()
log.info "currentRow First is --" + currentRow
def rowCount = context.testCase.getTestStepByName("PNRDataSource").rowCount
log.info "rowCount-- " + rowCount
//for (def i = 0; i < rowCount ; i++)
for (row in 1..rowCount)
{
//castToString= Integer.toString(i)
//log.info "castToString---" + castToString
//context.testCase.getTestStepByName("PNRDataSource").setStartRow(castToString)
currentRow = context.testCase.getTestStepByName("PNRDataSource").getCurrentRow()
log.info "currentRowSecond is --" + currentRow
execute = context.testCase.getTestStepByName("PNRDataSource").getPropertyValue("Execute")
operationName = context.testCase.getTestStepByName("PNRDataSource").getPropertyValue("operationName")
pre_requisiteOperation = context.testCase.getTestStepByName("PNRDataSource").getPropertyValue("pre_requisiteOperation")
log.info "execute is --" + execute
log.info "operationName is --" + operationName
log.info "pre_requisiteOperation is --" + pre_requisiteOperation
testRunner.testCase.getTestStepByName('PNRDataSource').next(testRunner, context)
//context.testCase.getTestStepByName("PNRDataSource").next(testRunner,context)
currentRow = context.testCase.getTestStepByName("PNRDataSource").getCurrentRow()
log.info "currentRowThird is --" + currentRow
}

 

Here is the execution response log information:

 

Wed Mar 07 16:56:18 CST 2018:INFO:currentRow First is --0
Wed Mar 07 16:56:22 CST 2018:INFO:rowCount-- 3
Wed Mar 07 16:56:26 CST 2018:INFO:currentRowSecond is --0
Wed Mar 07 16:56:31 CST 2018:INFO:execute is --false
Wed Mar 07 16:56:32 CST 2018:INFO:operationName is --eDocumentConsent
Wed Mar 07 16:56:32 CST 2018:INFO:pre_requisiteOperation is --optIn
Wed Mar 07 16:56:38 CST 2018:INFO:currentRowThird is --1
Wed Mar 07 16:56:38 CST 2018:INFO:currentRowSecond is --1
Wed Mar 07 16:56:38 CST 2018:INFO:execute is --true
Wed Mar 07 16:56:38 CST 2018:INFO:operationName is --optOut
Wed Mar 07 16:56:38 CST 2018:INFO:pre_requisiteOperation is --optIn
Wed Mar 07 16:56:38 CST 2018:INFO:currentRowThird is --2
Wed Mar 07 16:56:38 CST 2018:INFO:currentRowSecond is --2
Wed Mar 07 16:56:38 CST 2018:INFO:execute is --true
Wed Mar 07 16:56:38 CST 2018:INFO:operationName is --resendMessage
Wed Mar 07 16:56:38 CST 2018:INFO:pre_requisiteOperation is --sendMessage
Wed Mar 07 16:56:38 CST 2018:INFO:currentRowThird is --3

 

Also attached is the excel sheet that I am using as the data source. - PNRDataSource.xlsx

Also attached is a snap shot of the test suite in SOAPUI Pro. - TestSuite.png

 

Please let me know what am I missing?

 

Thanks

No RepliesBe the first to reply