KBEC-00243 - Best practices when creating an external custom report

Summary

Sometimes you may need more information than ElectricFlow reports offer.

This article discusses how to create external custom reports using XML data extracted from job details.

Solution

For instance, if you want to send an XML report about job details to an external system, add a step at the end of the build that runs:

ectool getJobDetails $[/myJob/jobId]

That command returns an XML document with all of the job's details and the jobSteps that can be sent to an external system.

A common practice is to collect build metrics, such as # of tests run, # of tests passed, # of tests failed, or code coverage metrics or static analysis metrics. This usually involves running a tool to create the metrics and many of these tools (like junit or cobertura or clover) generate their own XML reports.

In that case, ElectricFlow can pass the XML report to the external reporting system.

Some guidelines:

In general, it's much easier to send data to an external system as part of each build or test Procedure, so that the data is sent when it is gathered. In other words, avoid running reports on historical jobs.

ElectricFlow's Perl API and ectool interface return XML data for all commands by default. Any data that is stored in ElectricFlow can be retrieved in XML format using a Perl call or an ectool command and the returned XML can be sent to the external reporting system.

Many build and test metrics tools create their own XML results documents. In this case, ElectricFlow can run the tool and then pass the resulting XML document to the external reporting tool.