Forum Discussion

md1's avatar
md1
New Contributor
4 years ago

Need SoapUI to write TestRunner automation success or failure message to 1 of 2 files

Please help!

I need a Groovy script to do the following SoapUI automation.

 

if(TestRunner has failed) then,
      overwrite "no duplicates allowed error" or "plain old error" into
      a new file named "FAILED.txt"

else if (TestRunner has success) then,
      overwrite "Ok" into a new file named "SUCCESS.txt"



Or possibly could these 2 files be written into with some kind of SoapUI report feature?


Thanks in advanced

  • TNeuschwanger's avatar
    TNeuschwanger
    Champion Level 1

    Hello md1 

    So maybe someone can share a groovy script to do this or you could code it up yourself if no one responds...

     

    Your request is a little too general for a specific answer however. Do you mean "testRunner" variable for each test case in a Suite where you would need the Groovy script in a TearDown Script to append (probably not overwrite) to a file?  Do you mean "TestRunner" batch file that runs from a command line to launch a SoapUI project and evaluate the result of the run? 

     

    I can answer the later (as a work around), but it is for the Microsoft command line launch of TestRunner where the resultant error level can be evaluated.  It is just DOS command usage and not a groovy script however, but literally does what your request asked.

     

    E:
    cd E:\Program Files\SmartBear\SoapUI-5.6.0\bin
    
    cmd.exe /C testrunner.bat -s"Test Suite 1" -c"json compare not using json" D:\Data\Download\Sandbox-readyapi-project.xml
    
    echo Exit Code is %errorlevel%
    
    IF %errorlevel% EQU 0 (
    echo "Ok" > F:\SoapUI\Sample\SUCCESS.txt
    del F:\SoapUI\Sample\FAILED.txt
    ) ELSE (
    echo "plain old error" > F:\SoapUI\Sample\FAILED.txt
    del F:\SoapUI\Sample\SUCCESS.txt
    )
    
    pause

     

    • md1's avatar
      md1
      New Contributor

      Hi TNeuschwanger,

      I am running TestRunner at a Terminal command prompt.

      I need a soapUI project to write to a report to a new text file named "Success.txt" upon a
      successful run, and I need the soapUI project to also write a report to a new text file
      named "Failure.txt" upon an error.

      I prefer to do this by clicking on a checkbox or something with in SoapUI program.
      Something to enable error and success reports.

      Thanks in advanced!