Forum Discussion

jkrier's avatar
jkrier
Regular Contributor
7 years ago

Iterate rows in JDBC Data Source

Does anyone know how to iterate over the result set returned by the JDBC Data Source? I can only seem to get the last row in the set.

 

This is what I have come up with so far

 

def var = testRunner.testCase.testSteps['DataSource']
def rowCount = var.rowCount as int
log.info "ROW COUNT = " + " " + rowCount
for ( item in rowCount ){
		log.info var.getProperty('systemId').value
}

This will only return the very last row in the query results.

 

In my project I have 3 Data Sources. The second Data Source is the one I want to iterate through. I want to collect some values, pass them into a Properties step and then validate a subsequent Soap response against these values.

 

I can't think of a way to do this using Data Source Loops, which I am using for the other two Data Sources but the middle Data Source is not being used for gather inputs, I just want to validate a response later on based on the query results.

4 Replies