Ask a Question

Change project variables per Jenkins run

Ashcutus
Occasional Contributor

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 3
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.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

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.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Ashcutus
Occasional Contributor

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

 

Cheers!

cancel
Showing results for 
Search instead for 
Did you mean: