Forum Discussion
Radford
9 years agoSuper Contributor
The following code is from one of my test case startup scripts:
def activeEnviroment = testRunner.getTestCase().getTestSuite().getProject().getActiveEnvironmentName() log.info('Active enviroment = ' + activeEnviroment)
You need to get hold of the project object as this is where most of the methods relating to environments are, depending where your Groovy script is it might be subtly different from the above.
Note: That getActiveEnvironmentName is implemented by a "Pro" class so the method doesn't show up in Ready API code completion (This limitation was raised with SmartBear issue API-957).
- jays9 years agoOccasional Contributor
Thank you and that works! And here is what I found which works too.
testRunner.testCase.project.getActiveEnvironment().name
gives you the active environment name in Pro.
Related Content
- 7 years ago
Recent Discussions
- 5 days ago
- 10 days ago