Service Virtualization

Expand all | Collapse all

How do I reset the counter when using "Read Rows From a JDBC table"?

  • 1.  How do I reset the counter when using "Read Rows From a JDBC table"?

    Posted May 27, 2017 04:48 AM

    Hello,

     

    In CA Dev Test, I have a double loop in my test case using "Read Rows From a JDBC table" as the Data Set.  To debug, I have limited the data to only have 2 records to loop through.  The first time the script goes through, it correctly set "Read Rows from a JDBC Table~1_RowNum" to "1", then to "2" and then moves to execute the other loop.  But then when it gets to run the steps a second time for a different set, the "Read Rows from a JDBC Table_RowNum" value is still set to 2 so I get "Step not executed. A data set has encountered the last line of data and is exiting the workflow" and the step is not executed.

     

    I need to find a way to reset the "counter" so I can go through it multiple times.  

     

    For a numeric counter I could reset the counter using:

    //import com.itko.lisa.test.DataSet;
    //import com.itko.lisa.test.DataSetManager;

    //testExec.setStateValue("lisa.counter.reset", true);

     

    But I have not been able to find a way to reset the counter for a "Read Rows from a JDBC table"

     

    Thanks for your help,

     

    Monica



  • 2.  Re: How do I reset the counter when using "Read Rows From a JDBC table"?
    Best Answer

    Broadcom Employee
    Posted May 28, 2017 10:08 PM

    Hello Monica,

         The simple solution is to use "subprocess". If you want to reset the data sheet row to the beginning, add first iteration to subprocess step and call that subprocess to main test case. So that, once the first iteration complete and when you loop it again, it will recall the subprocess and datasheet will reset to first row.

     

    Thanks

    Srikanth 



  • 3.  Re: How do I reset the counter when using "Read Rows From a JDBC table"?

    Posted May 30, 2017 04:09 AM

    Hello Srikanth,

     

    Putting the test steps into a sub-process worked well so I'm using that .  Thanks!

    Still, it will be helpful to have CA Dev Test provide a clear way to help reset JDBC counters.

     

    Monica