Forum Discussion
rupert_anderson
9 years agoValued Contributor
Hi,
The testRunner variable is not exposed within Mock scripts, there is a mockRunner instead - in other words, mocks can't access properties in that way.
However mocks can access Global properties from within mock scripts e.g.
def globalProperty = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue(
"MyProp"
)
Regards,
Rupert
- elnreum9 years agoNew Contributor
Super, Rupert. Thanks that works indeed !!
Test case scripting:
com.eviware.soapui.SoapUI.globalProperties.setPropertyValue("csi-iamp", "someresponse")
Mock response scripting:
def response = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue("csi-iamp")
log.info("response = " + response)
if (response != null) {
mockOperation.setDefaultResponse(response);
}- rupert_anderson9 years agoValued Contributor
No problem, happy to help :-)