Forum Discussion

em_qdx's avatar
em_qdx
Occasional Contributor
3 years ago

How to script creating report and then email link to report location for ReadyAPI functional test

I need to find a method to create a report for a ReadyAPI functional test and then email a link to the report location.  I want to be able to provide a report to users after they run a functional test.

6 Replies

  • aaronpliu's avatar
    aaronpliu
    Frequent Contributor

    em_qdx ,

    you may need to collect test results information and construct HTML report by yourself.

    It's very easy to create a HTML report.

    All of test running information would be retrieved from testResults.

    For instance:

    // retrieve test running info
    for (r in runner.results.sort {it.getStartTime()}) {}
    
    // construct HTML report
    def writer = new StringWriter()
    def builder = new groovy.xml.MarkupBuilder(writer)
    builder.html {
        head {}
    }

     

    Thanks,

    /Aaron

  • nmrao's avatar
    nmrao
    Champion Level 3

    Can't the ReadyAPI tool does this out of the box (might need some configuration)?

    By the way, are you hosting the test result / report into some web server ? How are you doing this part?

    • KarelHusa's avatar
      KarelHusa
      Champion Level 3

      nmrao ,

      as far as I know there is no function to send a report automatically in ReadyAPI.

       

      In ReadyAPI there are nice options of reporting, however I am not aware of any way to execute a follow-up action. In the end the report files are placed in the output directory.

       

      On TestCase and TestSuite level there are Report script holders, but the purpose of the script is to extend the scripting options (i.e. is executed before the reports are finished, not after). on project level there is nothing.

       

      A good place to execute specific actions are the events. But here there is no "TestRunListener.afterReport" event. The closest available is TestRunListener.afterRun, but at that time report isn't created yet. But you can take the TestRunner's result data, process them and send them via Groovy.

       

      So, the follow-up action to take the standard report, put it somewehre and send a notification has to be done externally, e.g. from the CI/CD pipeline.

       

      This might be a good point for a reature request.

       

      Best regards,

      Karel