Forum Discussion

rmnrdi's avatar
rmnrdi
Contributor
7 years ago

Setting TC wide variables that are globally available for all projects

Is there a way to set global variables for all of TC? Script Extension properties maybe?   The applications we're testing have paths to various folders. These folders will need to be accessed fro...
  • AlexKaras's avatar
    7 years ago

    Hi Rob,

     

    Yes, Project or ProjectSuite variables are global for the whole project or project suite respectively.

    They can be either persistent or temporary. Both of them can be assigned values to, but the former persists assigned value into the project file (and thus the value is preserved between test runs) while the latter does not persist. Note, that as persistent variable saves its value into the project file, the file is marked as changed by OS and you may be getting notifications from OS and version control system about changed source file.

     

    The values of your project suite variables do not change because a new value is not assigned to them.

    One possible modification of your code:

    function SetInnovationsVariables()
    {
        ProjectSuite.Variables.ArchivePath = AssignPathVariable("ArchivePath","String","Archive");
        ProjectSuite.Variables.OutgoingPath = AssignPathVariable("OutgoingPath","String","Outgoing");
          
        Log.Message(ProjectSuite.Variables.OutgoingPath); 
    }