Showing results for 
Search instead for 
Did you mean: 

Configure ReadyAPI new environment using Groovy

Occasional Contributor

Configure ReadyAPI new environment using Groovy

We are executing ReadyAPI soap testcases in many environments, and now we need to create automation suite for different functionality in all those environments. Problem is to define all environments and lots of endpoints every time we create new projects.

Is there any way to configure new environments using Groovy scripts so that I can use 'Scripts library' feature to load all the environments  when ever I create a new project in ReadyAPI.


Community Leader

Re: Configure ReadyAPI new environment using Groovy

@UhsBat :


You can try below commands to get the Active Environment name and and set new environment by name:


//To get the active Environment:
def env = testRunner.testCase.testSuite.project.getActiveEnvironment().getName()"Active Environment: " + env)
//To change the active Environment:
def env =  testRunner.testCase.testSuite.project.getEnvironmentByName("<ENV NAME>");


Hope it will help you 🙂


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓

Thanks and Regards,
Himanshu Tayal
Occasional Contributor

Re: Configure ReadyAPI new environment using Groovy


Using setActiveEnvironment I can only set the existing environment. But I want to create a new environment in ReadyAPI using groovy scripts.



suppose I have two envs DEV1 and SIT1, now I want to clone DEV1 and rename it as UAT1 or create a new env UAT1.

Community Hero

Re: Configure ReadyAPI new environment using Groovy

There are different ways of doing it.


Here another way to accomplish the same (without even using the environment feature)

Community Manager

Re: Configure ReadyAPI new environment using Groovy

Thank you Community Heroes🙂


@UhsBat Have you tried the latest advice from this thread? How did it go?

Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Script Wanted
Let's start July with new challenges!

Create a script to change request body before sending it to the server for the TechCorner tag!

Scripts created in June:
- A script to generate a request body based on data from Datasource
- A script to go through all response nodes and check the value of the required field
- A Dispatching script to get responses based on the values in Request Body
- A script to add a new tag and assign it to all TestCases in a TestSuite
Top Kudoed Authors