Forum Discussion
Aaronliu
14 years agoFrequent Contributor
Hi anuvinut,
if you want to save data to a text file, you can reference the code fragment below
(thanks for Pradeep Bishnoi provided)
Thanks,
Aaron
if you want to save data to a text file, you can reference the code fragment below
import com.eviware.soapui.support.XmlHolder
def stepName = "TestStepName" // to change the step name depending on your step name
def testStep = testRunner.testCase.getTestStepByName(stepName)
def testreq = testStep.testRequest //request
def folderName = "C:/Response"
def createFolder = new File(folderName)
createFolder.mkdirs()
def date = new Date()
def xHolder = new XmlHolder(testreq.response.contentAsString)
def f = new File(folderName+'/'+date.getTime()+'.txt')
f.write(xHolder.prettyXml)
xHolder.clear()
(thanks for Pradeep Bishnoi provided)
Thanks,
Aaron