Forum Discussion

Josh_147's avatar
Josh_147
Contributor
4 years ago
Solved

How to get the current count of Data-Driven Loop by using script?

Hi all,

 

I have a Data-Driven Loop and the data variable is a .csv file.

 

Is there any way to know the current count number of the running Data-Driven Loop? The simplest way could be adding the numbers in .csv file but I'm trying to not doing that.

Is it possible to get the count number by using script?

 

Thanks!

  • Hi,

     

    I am not sure that data-driven loop provides a loop counter, so either add a column to the datafile as you already suggested or implement a counter variable in your test code. (Exact implementation may depend on how data-driven loop is implemented in your case.)

     

1 Reply

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I am not sure that data-driven loop provides a loop counter, so either add a column to the datafile as you already suggested or implement a counter variable in your test code. (Exact implementation may depend on how data-driven loop is implemented in your case.)