Forum Discussion

DCat1223's avatar
DCat1223
Frequent Contributor
9 years ago

Data-Driven Loop not returning to beginning

Good afternoon …

 

I have a keyword test I am running that is using a data-driven loop.  As you can see from the attached screenshot, the loop is the first item on the test.  The test runs through 14 or so different test cases then should end up back at the beginning of the loop to begin again with the next scenario.  The test is running well up until the end when it cycles back to the loop.  I would expect the loop to return me to the beginning of the attached test case but instead I am returned to around line 18 - the If…Then statement highlighted in the attachment.  

 

I can’t figure out what I am missing with this test.  The loop is running off of a Project Suite Variable.  I am hoping somebody can see what I am missing here. 

 

Thanks! 

Dave.

  • After a few days of struggling through this, I was able to get this to work. I was able to solve this by moving the section of the Keyword test that the loop was returning to to it’s own test case within the project.  I'm not sure why it was problematic to begin with but in any event, this is now behaving as I would have wanted.  I hope this helps anybody that may encounter a similar situation.

5 Replies

  • cunderw's avatar
    cunderw
    Community Hero

    Under If check that re-runs the KWT, insert a run code snippet operation right before calling the KWT.

     

    The code snippet you want to put in it is

     

    "ProjectSuite.Variables.emp.Iterator.Reset()"

     

    This will reset the position back to the top of your table variable before re-running that KWT.

    • DCat1223's avatar
      DCat1223
      Frequent Contributor

      Thank you, cundrew.  That got me back to the beginning of the loop, but now it's not selecting the next scenario in the loop.  It's running the first one through again, so I'm guessing I have other issues here.  It is a Project Suite variable I'm running off of.  Any thoughts on where to troubleshoot?  I've attached the last portion of the final test case that ends the loop.

      • cunderw's avatar
        cunderw
        Community Hero

        Looks like you have it in the wrong section. You should have it be part of the If, Then that recalls the test. 

         

        It looks now like you have it position to run for every iteration so it will never move to the next one since it resets every loop.