How to retrieve the selected environment from the command line (-E) in a groovy script?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to retrieve the selected environment from the command line (-E) in a groovy script?
Hi all,
I know how to retrieve the active environment from the project (UI) using this solution.
However I want to know how to get the environment which is provided as a commandline parameter (e.g. when started via soaprunner.bat) like :
-ELOCAL_ENV
Is this possible with groovy scripting ?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The link you mentioned has step to retrieve the environment name using groovy only.
And the command line option you mentioned is to set the environment.
So, do not understand the problem.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Rao,
When the SoapRunner.bat is used to run a test, the environment can be supplied using that -E command line parameter.
Now inside my test, I want to use a groovy script to retrieve the value for this -E command line parameter so that I can determine the environment. This environment is then used by the script script to do some specific business logic. (I don't want to use the saved selected environment from the project, but I want to use this value.)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for the confusion.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And you already know how to access environment name in the groovy script based on the link you provided in the question i.e.,
testRunner.testCase.project.getActiveEnvironment().name
Hope it is clear and no confusion.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think that statement
testRunner.testCase.project.getActiveEnvironment().name
is not correct.
I have the feeling that the value saved in the project-url is overwrting the value on the command-line.
I'll do some more testing.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not sure if this is relevant or not, but quite a while ago I raised a very similar sounding issue with SmartBear support about the -E command line parameter being ignored. SmartBear support responded with:
"I was able to reproduce the issue on our end. I will create a bug once our developers approve, The logs are not updated but fortunately it takes the environment variables even if the log shows a different active environment. Thanks a lot for bringing this issue."
This issue was logged with the internal defect number SOAP-1741.
Please note, I raised this issue with a very old version (SoapUI Pro 5.1.1) but because 95% of our tests were run in a single environment and the fact that no date could be given for a fix we got in the habit of saving our projects in the "correct" environment as a work around. I've actually no idea if this has been fixed or not.
It might be an idea to raise an issue with SmartBear support (If you've got time to burn you could check through all the release notes).
Please post any follow up from support here as I'd be interested to know.
