Ask a Question

Getting several rows per iteration not working properly?

SOLVED
JustinM89
Contributor

Getting several rows per iteration not working properly?

I have a spreadsheet with which I need to iterate 2 rows at a time. I have followed this documentation:

http://readyapi.smartbear.com/structure/steps/data/source/multirow/start

 

Yet the property expansion syntax does not work for me. I have a Groovy script and am using:

def x = context.expand( '${DataSource#level::0}' );

 

Where 'level' is the name of a property in my datasource. But this property expansion always returns nothing. If I remove the '::0', it returns the value of the most recent row. Am I missing something? I've tried removing the 'context.expand', switched around the positions of the single quotes, nothing is working.

1 ACCEPTED SOLUTION

Accepted Solutions
JustinM89
Contributor

Re: Getting several rows per iteration not working properly?

I put in a case with SmartBear support and got this resolved. Turns out, when just executing the Groovy script, it has no context of the DataSource and can't find the values, but it will pick them up when executing the test case. Makes sense, but it does make debugging Groovy scripts a little more difficult.

View solution in original post

5 REPLIES 5
JustinM89
Contributor

Re: Getting several rows per iteration not working properly?

So I've gotten this to work, but I'm not sure how. Within my same project I added a new DataSource pointed to the exact same Excel sheet I was using, and made a Groovy script using the exact same syntax I was using and it's magically working now.

JustinM89
Contributor

Re: Getting several rows per iteration not working properly?

OK, now I'm back to square one -- this has suddenly stopped working again and I have not touched this project.

 

Attached is a screenshot of my script result. I know that my datasource is working and configured properly because using the normal syntax to retrieve a value works. It's only when I use the syntax to retrieve a row by index that this returns nothing. 

 

JustinM89
Contributor

Re: Getting several rows per iteration not working properly?

I put in a case with SmartBear support and got this resolved. Turns out, when just executing the Groovy script, it has no context of the DataSource and can't find the values, but it will pick them up when executing the test case. Makes sense, but it does make debugging Groovy scripts a little more difficult.

View solution in original post

MattiH
Staff

Re: Getting several rows per iteration not working properly?

If you set a breakpoint in the Groovy Script TestStep and then executes the whole TestCase using the Debug icon in the TestCase editor (instead of the Play button) the context should be correct when the Debugger stops the execution on the breakpoint.

 

Best regards,

 

Product Owner SoapUI/LoadUI
JustinM89
Contributor

Re: Getting several rows per iteration not working properly?

Matti's suggestion above works as well, in debug mode it will pick up the values from the spreadsheet. OK, I am satisfied now!

cancel
Showing results for 
Search instead for 
Did you mean: