Forum Discussion

nebsta's avatar
nebsta
Contributor
10 years ago

Persisting ProjectSuite Variables

Hi,   I have structured my TestComplete Project Suite in such a way that each functional area of the UI has a separate Project. My requirements are that:   1) Some of my tests rely on data create...
  • joseph_michaud's avatar
    10 years ago

     

    Persistent variables have a "Default Value" and a "Local Value".  For that matter, temporary variables also have a "Default Value" and a "Local Value" (but the local value is not shown).  Your test always works with the local value, however the local value is initialized differently.

     

    For temporary variables, the local value is initialized from the default value when the test starts on the machine.  You can watch the local value by adding the temporary variable to the Watch List during the test run.

     

    For persistent variables, the local value is initialized from the default value when the *project suite* is initialized on the machine.  When you create a persistent variable manually (by using the GUI to add it to the Project Suite or Project), you are assigning a default value and a local value.  When you create a persistent variable programmatically, you are assigning a default value (!) to the default value and local value (Working With Project and Project Suite Variables in Scripts).  The default value for persistent variables is somewhat pointless on the local machine because once you've created the persistent variable, you've also assigned the local value.  *However*, if you share the project suite on another machine, then the other  machine will have its own copy of the persistent variables and their local values will be initialized from the default values.

     

     

    Kinda confusing.  Took me a while to get it straight (and I'm still not sure I've got it all...)

     

     

    Getting back to your problem:

     

    1) Sounds like you are using a temporary Project Suite variable rather than a persistent variable.  See Project And Project Suite Variables - Overview

     

    2) Here, it sounds like you're using persistent variables and expecting that the default value will re-initialize the local value.  Not so.  Once the local value of a variable has been set, the default value is no longer of use.  (and you've set the local value simply by having created the variable)