Ask a Question

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

em_qdx
Occasional Contributor

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 6
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
Community Hero

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?



Regards,
Rao.
KarelHusa
Super Contributor

@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

 

 

 

Karel@apimate.eu
https://apimate.eu

I just raised a feature request:

 

Regards,

Karel

Karel@apimate.eu
https://apimate.eu

Thanks for that @KarelHusa 

 

Have used SoapUI Open Source with Apache Ant to execute and generate Junit html style report. Don't remember about email. However, it is possible to send mail from build.xml.

Of course, the above is run from command line and the same ant targets can be called from Jenkins job as well.



Regards,
Rao.

Hi...need  help related to same topic..Want to send the email with report generated after project run is Completed...how can it be done...any possible script or solution?

Apache Ant to execute and generate Junit html style report.is Script available for this?

cancel
Showing results for 
Search instead for 
Did you mean: