GeekInterview.com
Results 1 to 3 of 3

what this loop is executed twice?

This is a discussion on what this loop is executed twice? within the QTP forums, part of the Software Testing category; Hi, I'm a newbie for QTP and I've seen this simple script in this site. I've created 2 values for 'Colunm1' in data table, but when I ran, the for ...

  1. #1
    jfernandez1977 is offline Junior Member Array
    Join Date
    Jun 2012
    Answers
    2

    what this loop is executed twice?

    Hi,

    I'm a newbie for QTP and I've seen this simple script in this site. I've created 2 values for 'Colunm1' in data table, but when I ran, the for loop is executed twice. Can someone explain? Thanks.

    C = datatable.getrowcount
    msgbox "count is " & C
    For i=1 to c
    datatable.setcurrentrow(i)
    msgbox Datatable.Value("Column1")
    Next


  2. #2
    jfernandez1977 is offline Junior Member Array
    Join Date
    Jun 2012
    Answers
    2

    Re: what this loop is executed twice?

    got the answer. by selecting "only loop once" in settings -> run, I got it right. But still I don't understand, why when 'loop all the rows in datatable" when I only have 2 rows and it loops those 2 rows twice.


  3. #3
    millersi is offline Contributing Member Array
    Join Date
    Jul 2010
    Answers
    46

    Re: what this loop is executed twice?

    The 2 rows are looped twice because the For Loop in the code runs both of the rows and then QTP runs the whole script twice.

    For Loop
    There are 2 rows
    For 1 to 2 (c)


    •    Sponsored Ads