简体   繁体   English

如何多次运行请求并将响应保存到 SOAPUI 中的单个文件?

[英]How to run the request multiple times and save the response to a single file in SOAPUI?

I'm developing an app in c# to communicate with SOAPUI.我正在 c# 开发一个应用程序来与 SOAPUI 通信。 I have a specific Test Case which called TERMEKADAT TestCase, I need to call this TestCase more time than 1 and save the data to file(all responses data to ONE file).我有一个名为 TERMEKADAT TestCase 的特定测试用例,我需要调用此 TestCase 的时间超过 1 次并将数据保存到文件(所有响应数据到一个文件)。 In the c# app I can call the test case using command line and I can storage the response, but i can do it one time(if i do this more times, the dump file will overwritten, so the latest datas are gone).在 c# 应用程序中,我可以使用命令行调用测试用例,我可以存储响应,但我只能这样做一次(如果我这样做多次,转储文件将被覆盖,所以最新的数据消失了)。 Can i somehow storage all requests data in ONE file?我能以某种方式将所有请求数据存储在一个文件中吗? Can SOAPUI append the responses in one file? SOAPUI append 可以在一个文件中响应吗?

I need to storage more responses in one file.我需要在一个文件中存储更多回复。

You could do it like this in a Groovy Script Test Step in your test case:您可以在测试用例的 Groovy 脚本测试步骤中这样做:

import com.eviware.soapui.support.XmlHolder
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)

def resp = new XmlHolder(context.response) //get the response object
def respXml = resp.getXml()                //get the XML string from the response

def respFile = new File("/your/dir/yourFile.txt")
respFile.append(respXml)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM