NeverBackDown
14 years agoOccasional Contributor
Get value from variable (in mock service script)
Hi,
I have mock service with 2 responses.
If value in request coincides with value in variable I want to use first response, if not coincides - 2nd response.
I wrote the following script in mock service:
The following error appears:
com.eviware.soapui.impl.wsdl.mock.DispatchException: Failed to dispatch using script; java.lang.NullPointerException: Cannot get property 'testSuite' on null object
Can you say please, how to use TestSuite variables in mock service scripts? Thanks.
I have mock service with 2 responses.
If value in request coincides with value in variable I want to use first response, if not coincides - 2nd response.
I wrote the following script in mock service:
def a=context.testCase.testSuite.project.getPropertyValue('RegNO') // I have 'RegNo' variable in TestSuite and want to get value from it
if (holder["//*:RegNo"]=='a') // I check if value in my request (<RegNo>value</RegNo>) coincides with 'a'
return "Response 1"
else
return "Response2"The following error appears:
com.eviware.soapui.impl.wsdl.mock.DispatchException: Failed to dispatch using script; java.lang.NullPointerException: Cannot get property 'testSuite' on null object
Can you say please, how to use TestSuite variables in mock service scripts? Thanks.
