通过SoapUI将结果导出到文本文件中 [英] Export result in text file by SoapUI
问题描述
我正在使用dotmailer.com ESP并使用SoapUI来调用API.我可以以JSON格式获取广告系列的摘要,但也想将该广告系列的摘要提取到文本文件中,但找不到任何方法.有人可以帮忙吗? 谢谢.
I am using dotmailer.com ESP and using SoapUI for calling API. I can get summary of the campaign in JSON format but also I want to extract summary of that campaign into a text file but couldn't find any way. Anyone can help? Thanks.
推荐答案
您可以使用groovy做到这一点.只需在testCase内添加一个groovy script testStep
,您就可以从上一个testStep获得响应并将其保存在文件中.由于您的问题中没有太多细节,一般的方法可以是:
You can do it using groovy. Simple add a groovy script testStep
inside your testCase, there you can get the response from a previous testStep and save in a file. Since there are not many details in your question a generic way to do so could be:
// get the test step
def testRequest = context.testCase.getTestStepByName('Test Request')
// get the response
def response = testRequest.getPropertyValue('Response')
// create a file
def file = new File('C:/temp/response.txt');
// save the response to it
file << response
希望有帮助,
这篇关于通过SoapUI将结果导出到文本文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!