How to access CONTEXT object in SAVE/LOAD script in Project Settings
Hi,
I use below two lines of code to check the active environment. Works perfectly in a groovy test step.
However if I put the same two lines in Project Settings->Save Script it does not work. Complains about null pointer.
Any suggestions on how to solve or why this is?
The message "Objects available by default: log, project" is presented but how do I access CONTEXT object?
def env = context.testCase.testSuite.project.getActiveEnvironment().getName()
log.info("Active Environment: " + env)
I have also tried with "log.info("env = " + project.getActiveEnvironment())" but that one returns "INFO: env = com.eviware.soapui.model.environment.EnvironmentImpl@1becd"
"
Hi,
Regarding your last line... "I have also tried with "log.info("env = " + project.getActiveEnvironment())" but that one returns "INFO: env = com.eviware.soapui.model.environment.EnvironmentImpl@1becd".
You've missed getName(). E.g. "log.info("env = " + project.getActiveEnvironment().getName())"