Forum Discussion

Ashcutus's avatar
Ashcutus
Occasional Contributor
8 years ago

Change project variables per Jenkins run

Hi guys,

 

I have a number of tests that I have running on a bunch of Jenkins slaves, however, I have a bunch of project variables that specify branches, browsers and other various things that will change over time.

 

I'm trying to specify what the parameters should be in Jenkins, but it appears that the tests are running, but using the default values - totally ignoring my new parameters.

 

Is there an easy way of specifying my new variables in Jenkins, before I tear my hair out?!

 

Cheers,

Ben

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Not directly via commandline, no.  You can access the parameters of the commandline for executing TestComplete/TestExecute but you'd have to write some custom code to read the parameters and set project variable values accordingly.

     

    One thing I've done in the past for similar situations is write a bit of code that reads from an INI file and populates variables based upon those values.  This I've found is easier than messing with command line parameters.  

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      HI,

       

      I would agree with Robert.

      TestComplete can open projects in a Shared (Networked) mode from the single common location and I used this functionality a lot in the old good times. In theory, Project Variables can have 'personalized' values when test project is opened in the Shared mode. Unfortunately, this seems to be broken now. Another problem with the Shared mode is that TestComplete must be installed on every slave machine in order to do variables setup (yes, it may require just one Floating license, but nevertheless).

      So for now I ended up with the solution that contains one common .ini file with several sections - one section per slave and one default one. Test code reads settings from the section that corresponds to the machine test code currently running at. If the specific parameter is not found in the 'personalized' section, the value from the default section is used instead.

      Another convenience of this approach is that configuration for any test slave can be done in one file from any location and you don't need to bother with version/branch/etc. of the version control system.

    • Ashcutus's avatar
      Ashcutus
      Occasional Contributor

      Thanks for the quick response Robert - I'll take a look at this and hopefully this will resolve my issue.

       

      Cheers!