Switching Environments Groovy Scripting
I am running automation on a Test Suite. There are 5 Private environments and 5 corresponding Public environments. I can kick off the automation in Jenkins with a starter Environment, i.e. QA. Each run will have to switch to Public 75% through. So in a run, it will have to switch from QA to Public QA, and 4 more switches to follow on the subsequent Jenkins job.
I have a script that can switch environments that I borrowed from Smartbear support:
def env = context.testCase.testSuite.project.getEnvironmentByName("Public QA2");
context.testCase.testSuite.project.setActiveEnvironment(env)
But it does not solve my dilemma.
Since I am running the same test suite for all environments I need a script that will switch depending on the current environment.
I am by far no JS or JSON coder, I get by, but it needs it to run like this:
if QA then Public QA
if QA2 then Public QA2
if UAT then Public UAT
if ENV1 then Public ENV1
if SITE then Public SITE
If someone could code that for me to run in a groovy script I would be forever indebted to you.