Forum Discussion

bbrown1's avatar
bbrown1
New Contributor
3 years ago

Groovy Script of Transaction Log results and details

When running all of the functional tests from within the ReadyAPI UI, you can view a list of steps run across all Suites and Test Cases from the Transaction Log tab. If a step fails (for example a REST Request step), you can click on it to access additional information such as the Raw Request and Raw Response (both shown under the Message Exchange tab).

 

I would like to log all of the failed steps (specifically if the step is a REST Request) to the Script Log along with some information from those tabs under the Message Exchange tab (Raw Response). I can't seem to figure out how to access that information via a groovy script though. I know I can add some logging within, for example, the Rest Request assertions, but that leaves a lot of room for error as we may forget to add that script to every new test case we write.

 

Also, it is correct that this type of script would need to exist in the TearDown Script tab?

 

I'm still struggling to understand the SDK for ReadyAPI (I'm not a developer, but have some general understanding of class structures). Does anyone know if there is a class diagram showing how all these classes are related?

  • TNeuschwanger's avatar
    TNeuschwanger
    Champion Level 1

    Hello bbrown1 

    Without knowing your desire for use of logged failures, you might consider just running your tests from the Command Line Interface (https://support.smartbear.com/readyapi/docs/functional/running/automating/cli.html).  By choosing and providing correct parameters, you can have an output directory that contains each and every test step activity.  The SOAP and REST log information result contains both the request and response for the invoke and I find very helpful handing the file over to developers to show an issue.  The filename of the individual test step results will contain the disposition of the run.  You could just choose the filenames ending in FAIL.txt to have all the information that could be important.  If the response generated from the running from the CLI meets your needs, then there is no need to spend cycles on how to script the logging of failures.

     

    Regards,

    Todd

  • bbrown1's avatar
    bbrown1
    New Contributor

    Thanks for the information, TNeuschwanger . I'll look that over.  One of my issues with the existing logging and reporting is that it only reports the failure at the test case level. We utilize Grid Data Sources, where each row in the grid is a separate test case. I need to be able to easily see which of those test cases (rows) are failing, rather than just the overall test case. 

     

    I'm open to any other ideas you may have.

    • TNeuschwanger's avatar
      TNeuschwanger
      Champion Level 1

      Hello bbrown1 

       

      Well, the results you get from running from the command line are different that a general report.  It actually generates a text file for every test step executed, not just the test case as a whole.  You will have to try it to see what I mean.  You will get a lot of files if it is a large suite, but it is good granularity that you can use to pinpoint which row of your Grid caused the failure.  A side effect of running from the command line is that you will have an audit trail of running the tests.

       

      Regards,

      Todd