Forum Discussion

Markal's avatar
Markal
Occasional Contributor
8 years ago

Set active environment by id or endpoint

Hi,
I'm working on a script in READYAPI and ran into the following problem. I have to create a script that switches environment 2 after the tests ran on environment 1. I have a solution for it, but it does not work on SOAP UI. Currently I use the environment names in the script to identify and change the envs. But in SOAP UI envrionments don't have names.

My question is there any other way to switch the environment from script? Like id or the endpoint? Or is there a way to get a list about the available environments?
Here is my code:

 

if(testRunner.testCase.project.getActiveEnvironment().name=="DevEnv")
{
	testRunner.testCase.project.setActiveEnvironment("IntegrationEnv")
	testRunner.gotoStepByName("TestStep1")
}

Thanks for the help!

2 Replies