Forum Discussion

Qasvat's avatar
Qasvat
Occasional Contributor
15 years ago

Automatically save request & response

Hello,

is there a possibility in soapUI pro 4.0 to automatically export request and response of every single test step in a project in some way? I don’t mind in which format this information is saved. Just want to archive the requests and the corresponding results of the test cases for documentation reasons.

Any suggestions?

3 Replies

  • Hello!

    There's no such built in functionality into soapUI. However, it's reasonably easy to script in a TestRunListener.afterStep EventHandler (Project Window > Events tab > Add new EventHandler):

    fos = new FileOutputStream( testStepResult.testStep.label, true )
    pw = new PrintWriter( fos )
    testStepResult.writeTo( pw )
    pw.close()
    fos.close()


    Voila!

    Henrik
    SmartBear Sweden

    PS. I've written about this here.
  • Qasvat's avatar
    Qasvat
    Occasional Contributor
    Hi Henrik,

    thanks a lot for your quick response!
    I just created an event handler with your script and started the test sequence via Test Runner.
    However, I could not find out where the information gathered with this script is being saved. I tried to enter a path and a filename in the terget-field of the Event Handler but that didn't work out.

    Can you tell me where this information is being saved?
  • Hi again!

    Sorry, I should have included the filepath in the code. Try this:


    filePath = "c:/Users/Henrik/TestResults/"
    fos = new FileOutputStream( filePath + testStepResult.testStep.label + ".txt", true )
    pw = new PrintWriter( fos )
    testStepResult.writeTo( pw )
    pw.close()
    fos.close()



    Regards

    Henrik
    SmartBear Sweden