Forum Discussion

Razattax's avatar
14 years ago

TestComplete keeps looking for Global variables in other Units

We have run into an issue several times now where we try to run a test in one unit and it fails because it cannot find object.  This object is in fact a global variable in a completely different unit.



Why does it look for these variables sometimes, it is an intermittent fault and the same test will run fine on other machines.

2 Replies


  • Hi Raz,


     


    That's strange that sometimes it works and sometimes it doesn't. What TestComplete version and script language are you using? 


     

  • hlalumiere's avatar
    hlalumiere
    Regular Contributor
    If the other unit is not included via USEUNIT, the variable does not exist in the running unit's context. This is pretty much how every programming language behaves. Think of each unit as a self contained class, not a module or static class. If you need a truly global variable use Project.Variables.



    Are you sure the object instance didn't just crash, or unexpectedly disposed, with the variable now pointing to Nothing?