groovy - SoapUI change response in REST mock service -
i'm trying mock rest service in soapui 5.0. i'm using groovy script in onrequest tab:
com.eviware.soapui.impl.wsdl.mock.wsdlmockresult mockresult = new com.eviware.soapui.impl.wsdl.mock.wsdlmockresult(mockrequest) def httpresponse = mockrequest.httpresponse httpresponse.setcontenttype("application/xml;charset=utf-8") httpresponse.writer << "<root><user>abc</user></root>" httpresponse.status = 200 return mockresult
and getting error:
could not find matching constructor for: com.eviware.soapui.impl.wsdl.mock.wsdlmockresult(com.eviware.soapui.impl.rest.mock.restmockrequest)
what's wrong? :(
yeah! i'm found solution soapui 5!
def httpresponse = mockrequest.httpresponse mockresponse.setresponsehttpstatus(202) httpresponse.setcontenttype("application/json;charset=utf-8") mockresponse.setresponsecontent('{"a": 1}')
Comments
Post a Comment