Forum Discussion

sameerjade's avatar
sameerjade
Frequent Contributor
7 years ago
Solved

While loop in TestComplete

Hello All,   I am trying to use a while loop within a function in a TestComplete test item. When I run my test, it seems to be ignoring my while loop not executing it. Following is the code snippet...
  • tristaanogre's avatar
    7 years ago

    How are you initializing the variable i?  At that point in the while loop, it is checking that value first... if i is > or = to three, you'll never enter the loop.

     

    What I would do is the following:

    var i = 0;
    while (i < 3) {
    MyObjectName.Click();
    i++;
    }