Forum Discussion

stein_oddvar_ra's avatar
stein_oddvar_ra
Contributor
4 years ago

Deleting added TestedApps shows strange behaviour in python

Hi,

 

I've just noticed something odd.

 

Our test application is adding a list of TestedApps for use and to be sure no apps are added twice, we purge all existing TestedApps first. This works when we're using JScript or CScript like this:

 

function del_applications()
{
  // Delete all TestedApps
  var count = TestedApps["Count"];
  for(var i = 0; i < count ; i++)
  {
    TestedApps["Delete"](0);
  }
}

 

Using Pyhon however gives a strange behaviour. This is the python script:

 

def del_applications():
  # Deletes all TestedApps
  count = TestedApps.Count
  for i in range(count):
    TestedApps.Delete(i)

 

The python script deletes exactly half of the applications, then the next time I run it, it deletes half of the remaining applications. I can do this until eventually I have deleted all the applications in TestedApps.

 

I'm using TestComplete 14.91.341.7 x64 on Windows 10 Standard, 64-bit (10.0 Build 17763)

  • Just curious, why not just create a list of Tested Apps once and leave it there?  

    • stein_oddvar_ra's avatar
      stein_oddvar_ra
      Contributor

      Yeah, why not?

      Legacy is the short and long answer. We probably can work around it, but since our test suite is a decade old by now the risk of breaking something is holding us back...

      • Marsha_R's avatar
        Marsha_R
        Moderator
        Because you can add them once manually and never have to do it again and never have it interfere with a test.