SoapUI/Groovy:展开txt文件,而不是重新写入它

SoapUI/Groovy:展开txt文件,而不是重新写入它,groovy,soapui,Groovy,Soapui,将响应表保存到文件中没有问题。类Smth def xmlFile = "C:/.../Try.xml" def response = context.expand( '${Request#Response}' ) def f = new File(xmlFile) f.write(response, "UTF-8") 但是 我使用新参数(使用while)在groovy脚本中重新运行我的请求,我需要将信息添加到结果文件中,而不是重新编写它。现在,它只是每次重新写入:(.File)都是在循环之外创

将响应表保存到文件中没有问题。类Smth

def xmlFile = "C:/.../Try.xml"
def response = context.expand( '${Request#Response}' )
def f = new File(xmlFile)
f.write(response, "UTF-8")
但是

我使用新参数(使用while)在groovy脚本中重新运行我的请求,我需要将信息添加到结果文件中,而不是重新编写它。现在,它只是每次重新写入:(.File)都是在循环之外创建的

提前感谢,, Dmitry

直接从

新文件('TestFile1.txt')。带有writerAppend('UTF-8'){w->

在追加模式下打开它?只需注意:不要使用“abcd”-插入变量或我们想要的任何东西
new File('TestFile1.txt').withWriterAppend( 'UTF-8' ){ w->
  w << 'abcdefghij'
}