Forum Discussion

JustinM89's avatar
JustinM89
Contributor
8 years ago
Solved

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.

  • 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.

5 Replies

  • 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's avatar
      JustinM89
      Contributor

      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's avatar
        JustinM89
        Contributor

        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.