cancel
Showing results for 
Search instead for 
Did you mean: 

How to switch second environments after ran the test in first environment?

SOLVED
New Contributor

How to switch second environments after ran the test in first environment?

Hi,

I created the Rest API scripts in the SoapUI pro tool. The default environment was set as "env1" from properties at the project level. Test suites are running smoothly.

Now I have connected the SoapUI with Eclipse and wrote some Java code to run my test suites using test runner. From eclipse, the test suite is also running correctly. But now I want to switch my environment from "env1" to "env2' after completion of one iteration. Can anyone suggest how to achieve this? Is there any script available for this?

I will appreciate your suggestions and help.

Regards,

Kumar

1 ACCEPTED SOLUTION

Accepted Solutions
New Contributor

Re: How to switch second environments after ran the test in first environment?

Hi @Olga_T @nmrao @Radford 

Thanks for your reply. I got some ideas from your comments and I was able to resolve the issue but in a different way. In SoapUI, I created two Test Suites with a groovy script to set the active environment in Env1 and Env2 respectively.

 

In Eclipse, using Java I created two methods- one for env1 & another for env2. I called the first method and ran all test suites one by one using for loop in env1. After that, I called the second method and ran all test suites in the env 2. 

This is the way, I achieved the solution. 

Regards,

Kumar

 

 

 

View solution in original post

5 REPLIES 5
Highlighted
Super Contributor

Re: How to switch second environments after ran the test in first environment?

The methods related to environments are on the project object, see the following Java Docs:

 

https://support.smartbear.com/readyapi/apidocs/pro/com/eviware/soapui/impl/wsdl/WsdlProjectPro.html

 

The WsdlProjectPro object has a method setActiveEnvironment which you should take a look at.

Community Hero

Re: How to switch second environments after ran the test in first environment?

Not sure why would some need to setup eclipse to execute the tests, instead use command line utility testrunner provided by the tool to execute the project and recreate report. This is the best way to do so.

Hope this solves your issue.
Have to property files, in the first one set environment 1, and environment 2 in the second file.
You can even execute them in parallel in two command windows.
Does it make sense?


Regards,
Rao.
Moderator

Re: How to switch second environments after ran the test in first environment?

Thanks for your suggestions, everyone!

 

@qakumar was your question answered? If so, can you mark this topic as solved?

Thanks in advance!

 


Olga Terentieva
SmartBear Assistant Community Manager

New Contributor

Re: How to switch second environments after ran the test in first environment?

Hi @Olga_T @nmrao @Radford 

Thanks for your reply. I got some ideas from your comments and I was able to resolve the issue but in a different way. In SoapUI, I created two Test Suites with a groovy script to set the active environment in Env1 and Env2 respectively.

 

In Eclipse, using Java I created two methods- one for env1 & another for env2. I called the first method and ran all test suites one by one using for loop in env1. After that, I called the second method and ran all test suites in the env 2. 

This is the way, I achieved the solution. 

Regards,

Kumar

 

 

 

View solution in original post

Moderator

Re: How to switch second environments after ran the test in first environment?

It's great to hear you've managed to accomplish the task!

Let me mark your latest reply as a solution.

 

Have a great day!

 


Olga Terentieva
SmartBear Assistant Community Manager

New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors