Forum Discussion

fayrehouse's avatar
fayrehouse
Frequent Contributor
11 years ago

Editing TC Project outside of TC

Folks,



Can anyone explain how / where Project level variables are stored in a TC project? 



To add some detail - we have uDeploy in place here, and we'll soon be wanting to run our TC project in different uDeploy environments, pointing the  TC code at different URLs. 



As such, I figure the simplest idea is to have the URL stored as a project level env in TC, and then have uDeploy change the TC project file where the URL, and other "varying" values are stored to fit needs for that run.



But where do project vars live? is it an editable text file of some sort?



Does anyone have a better suggestion to make it "uDeploy friendly"?



Cheers



SH



2 Replies

  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Hi Steve,



    You can't just edit a TC project file to change a project variable value. The variables are not cleary indentified with values easy to read in any of the xml format configuration files.



    Like Thomas, we went for the function variable setting option with something like this:



    function setProjectVariable(aVariableName, aValue)

    {

      
    Log.Message("Before Setting values");

      if( ! Project.Variables.VariableExists(aVariableName))

      
    {

       
    Log.Message("Project.Variables." + aVariableName + " does not exist. It will be created");

       
    Project.Variables.AddVariable(aVariableName);

      }

     

     
    Log.Message("Project.Variables." + aVariableName + " = " + eval("Project.Variables." + aVariableName +";"));

     
    eval("Project.Variables." + aVariableName + "=" + '"' + aValue + '"' + ";");

      Log.Message("After Setting values");

      Log.Message("Project.Variables." + aVariableName + " = " + eval("Project.Variables." + aVariableName +";"));


    }



    Sincerely


  • tbom's avatar
    tbom
    Contributor
    Why not make a "testcase" that changes the configuration?



    What I have done is having a central host, which the testsuite is querying about it's configuration, This is done as a standard SOAP webservice. I then have a script, which is run as the very first "testcase", which configures all the project (suite) variables.



    This doesn't need to be a webservice, it could also be a textfile on each test execution host, that the script could load with information about where it is running, and what to connect to.



    So no need to change the configuration files directly before starting up the testrun.



    / Thomas