Search code examples
requestresponsesoapui

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. 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). 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). Can i somehow storage all requests data in ONE file? Can SOAPUI append the responses in one file?

I need to storage more responses in one file.


Solution

  • You could do it like this in a Groovy Script Test Step in your test case:

    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)