Forum Discussion
We use a Windows Environment variable and matching TestComplete ProjectSuite level variable on our Virtual Machines that are kicked off via Jenkins. Jenkins sets the Windows Environment variable on the VM and we have a TestComplete script that pulls that value down and sets it as the server URL value.
Then we can add new test environments completely in Jenkins and let TestComplete use the same script at the beginning of each test run. This approach cuts down on our initial overhead and maintenance.
Currently we have about 15 different URLs we use for our live and test environments and about 12 different TestComplete projects that we can kick off individually or in tandem.
- nicklott8 years agoOccasional Contributor
Thanks for responding! We use Octo as opposed to Jenkins. I know there's a place in Octo where you can set the environment that you want to deploy to. What we're trying to do is capture the environment from Octo, and set the environment variable in the ProjectSuite to be whatever that Octo environment is, so that the tests kick off when we deploy. It's virtually the same thing that you're describing, except we're trying to use Octo to do it instead of Jenkins.
Could you share an example of the TestComplete script that you guys are using to pull the environment value down from Jenkins?
- bo_roop8 years agoContributor
Sample Code:
ServerURL = aqEnvironment["GetEnvironmentVariable"]("TC_ServerURL") // Set the TestComplete variable if the value isn't blank. if(ServerURL != "") { Log["Message"]("The Windows TC_ServerURL Environment Variable = " + ServerURL); // Save the URL to the projectSuite variable ServerURL ProjectSuite["Variables"]["ServerURL"] = ServerURL } else { Log["Warning"]("The ServerURL environment variable is blank. We'll use whatever is there currently.") }
Enjoy!