cancel
Showing results for 
Search instead for 
Did you mean: 

Configure ReadyAPI new environment using Groovy

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
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)

https://stackoverflow.com/questions/37655778/soapui-ability-to-switch-between-database-connections-f...



Regards,
Rao.

View solution in original post

4 REPLIES 4
Highlighted
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() 
log.info("Active Environment: " + env)
//To change the active Environment:
def env =  testRunner.testCase.testSuite.project.getEnvironmentByName("<ENV NAME>");
testRunner.testCase.testSuite.project.setActiveEnvironment(env)

 

Hope it will help you 🙂

 


Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Highlighted
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.

 

Ex:

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.

Highlighted
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)

https://stackoverflow.com/questions/37655778/soapui-ability-to-switch-between-database-connections-f...



Regards,
Rao.

View solution in original post

Highlighted
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

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Filtering data retrieved from a DataSource

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors