Forum Discussion

Wiggumon's avatar
Wiggumon
Occasional Contributor
12 years ago

Saving Test Results to File

Hello,

I have been saving test results to a file using an event: TestRunListener.afterStep with the following source.


def filePath = 'c:/output/'
def fileOutputStream = new FileOutputStream(filePath + testStepResult.testStep.label + '.txt', true)
def printWriter = new PrintWriter(fileOutputStream)
testStepResult.writeTo(printWriter)
printWriter.close()
fileOutputStream.close()


This works great! One question I have though. Is it possible to write out all the same data but leave any password or username information out of the output? All other data is great...

Thanks!

6 Replies

  • I want to do it similary to your scipt. I am at Ready!API and no programmer. 

    My task is to run about 100 testcases in one testsuite with each of them has up to 15 teststeps. So I want to have the results seperatet by the TestCase names. But using your script, I only have the Requests of the teststeps - not any result. And also I cannot get the TestCase name as n part of the TestStepName. 

    Afterwards I have to compare the files with the results of older application versions. So my filesystem should look like:

     

    testSuite_version_1

      testCase_1

        testStepRS_1

        testStepRS_2

        ...

        testStepRS_n

      testCase_2

       ...

    Is there anybody who can help me to get this automaitcly?

     

    • kondasamy's avatar
      kondasamy
      Regular Contributor

      Please check my plugin which does few of the job you have asked,

       

      https://github.com/Kondasamy/soapui-plugin-file-export

       

      Download the Plugin JAR from the release tab - Direct download link

       

      Here are few descriptions about the plugin,

      1) Supports SoapUI OS/ SoapUI Pro/ Ready! AP! - SoapUI NG

      2) Right click at Project/ TestSuite/ TestCase/ TestStep level and export results

      3) Automatically export results when run from Project/ TestSuite/ TestCase levels (except TestStep level)

       

      Please feel free to fork and improve! :smileyhappy:

       

      Thanks,

      Samy

       

  • i run above script and i get below error message on groovy

     

     

    groovy.lang.MissingPropertyException: No such property: testStepResult for class: Script1 error 
    • kondasamy's avatar
      kondasamy
      Regular Contributor

      @Codehauss: Please use the plugin as specified in the above comment. I have complete howto documentation over the github page.

       

      Thanks,

      Samy

      • codehausss's avatar
        codehausss
        Contributor

        Thanks Samy, just install your plugin, works like a charm.

        love it, just curious to ask about that plugins:

        - is it possible to change path of the output file?

        - currently only create folder per test suite, is it possible create folder per test case?

         

        thanks Samy for wonderfull plugin :)


        kondasamy wrote:

        codehauss: Please use the plugin as specified in the above comment. I have complete howto documentation over the github page.

         

        Thanks,

        Samy