plaidshirt
7 years agoContributor
Save attachments automatically in SoapUI with Groovy
I try to save all the attachments from a SOAP response. I use following Groovy script.
def testStep = testRunner.testCase.getTestStepByName("SubmitFile") def response = testStep.testRequest.response assert null != response, "response is null" def outFile = new FileOutputStream(new File(System.getProperty('java.io.tmpdir')+'/test.zip')) for(i=0; i<3; i++){ def ins = response.responseAttachments[0].inputStream if (ins) { com.eviware.soapui.support.Tools.writeAll(outFile, ins) } } ins.close() outFile.close()
I get following error message:
No such property : responseAttachments for class
This
def ins = response.responseAttachments[0].inputStream
should be
def ins = response.attachments[0].inputStream