Skip to main content
Version: QB90

Interact with Reports

For those reports supported by QuickBuild, you can retrieve the report data via RESTful APIs. The supported reports included:

Report CategoryBase URI
CheckStyle/rest/checkstyle
Cobertura/rest/cobertura
JaCoCo/rest/jacoco
CPD/rest/cpd
EMMA/rest/emma
FindBugs/rest/findbugs
Fxcop/rest/fxcop
JUnit/rest/junit
MBUnit/rest/mbunit
MSTest/rest/mstest
NCover/rest/ncover
NUnit/rest/nunit
PMD/rest/pmd
TestNG/rest/testng
Boost Test/rest/boost

NOTE

All report related RESTful APIs use http GET method.

List all supported APIs

URIResponse FormatParams
$baseURI/helpapplication/html

for example, all available RESTful functions for JUnit can be accessed by visiting the following URL:

http://quickbuild:8810/rest/junit/help

Get the version of category

URIResponse FormatParams
$baseURI/versiontext/plain

For example, you can get the current data version of the JUnit category.

http://quickbuild:8810/rest/junit/version

and it will return the data version 2.1(example only) in text/plain format.

List reports stored in the category

URIResponse FormatParams
$baseURI/reportstext/xml

For example, visit below URL to list all reports in JUnit category:

http://quickbuild:8810/rest/junit/reports

and the response looks like:

<list>
<string>unprocessed</string>
<string>tests</string>
<string>testsuites</string>
<string>packages</string>
<string>stats</string>
<string>agg_overview</string>
<string>agg_stats</string>
<string>tests_trends</string>
</list>

Get the report definition (meta data)

URIResponse FormatParams
$baseURI/meta/{report_name}text/xml* report_name : Specify the report name you want.

for example, when visit:

http://quickbuild:8810/rest/junit/meta/stats

the response looks like:

<meta name="stats" group="STATISTICS">
<column name="ID" isKey="false" indexed="false" nullable="false" updatable="false" sqlType="BIGINT" dataType="ID"/>
<column name="buildId" isKey="true" indexed="false" nullable="true" updatable="true" sqlType="BIGINT" dataType="ID"/>
<column name="duration" isKey="false" indexed="false" nullable="true" updatable="true" sqlType="BIGINT" dataType="DURATION"/>
<column name="tests" isKey="false" indexed="false" nullable="true" updatable="true" sqlType="INT" dataType="INTEGER"/>
... ...
</meta>

You may consider the report meta data as the schema of a table in database.

Each report has an attribute group and in QuickBuild, the following groups are used:

  • BUILD
  • STATISTICS
  • HISTORY
  • AGGREGATION

the group attribute tells QuickBuild where to find the report, for example, if a report belongs to BUILD group, then this report is stored in build related directory, otherwise, the report is stored in configuration related directory.

List all report sets / aggregations

In QuickBuild, the report data are stored by report sets or by aggregations. The report set is specified in the publish step, and the aggregation name is specified in the aggregation definition.

URIResponse FormatParams
/rest/junit/reportsets/{report_group}/{configuration_or_build_id}text/xml* report_group : The report group, can be one of the following: BUILD, STATISTICS, HISTORY, AGGREGATION * configuration_or_build_id: for BUILD group, the id should be a valid build id, otherwise, the configuration id should be specified.

for example, when visit below URL:

http://quickbuild:8810/rest/junit/reportsets/BUILD/103

the response looks like:

<list>
<string>DEFAULT</string>
<string>On Linux</string>
<string>On Windows</string>
</list>

Get the build stats

URIResponse FormatParams
/rest/junit/buildstats/{build_id}/{reportset}text/xml* build_id : Specify the build id. * reportset : the report set you want

for example, when visit:

http://quickbuild:8810/rest/junit/buildstats/103/DEFAULT

the response looks like:

<report name="stats" version="0.0.0" locale="en_US">
<row ID="1" buildId="103" duration="261466" tests="1006" errors="5" failures="7" skips="0" added="994" newFailed="12" notFixed="0" fixed="0" successes="994" success_rate="0.9880715705765407"/>
</report>

Get the report records

QuickBuild supply two functions to retrieve the detailed report records:

  • /size: get number of total records
  • /records: retrieve the report records by page
URIResponse FormatParams
/rest/junit/size/{report_name}/{configuration_or_build_id}/{reportset}text/plain* report_name Specify the report name * configuration_or_build_id According to the report you specified, supply a valid build id when report belongs to BUILD group, otherwise, configuration id is needed. * reportset Specify the report set or aggregation name * filters - QUERY_PARAM Specify filters based on SQL to filter the records, for example, duration>5 and duration<10, the fields available can be found in the report meta data definition.
/rest/junit/records/{report_name}/{configuration_or_build_id}/{reportset}text/xml* report name Specify the report name. * configuration_or_build_id According to the report you specified, the id is a build id when report belongs to BUILD group, otherwise, configuration id is needed. * reportset The report set or aggregation name * offset - QUERY_PARAM The first record you want to retrieve. By default, the offset is 0, i.e., from the first record. * limit - QUERY_PARAM The number of records you want to retrieve. By default, the number of limit is 50. * filters - QUERY_PARAM Specify filters based on SQL to filter the records, for example, duration>5 and duration<10, the fields available can be found in the report meta data definition.

for example, first we get a total tests in our JUnit for build 103 by visiting below URL:

http://quickbuild:8810/rest/junit/size/tests/103/DEFAULT

and 1005 is returned, that is, there are 1005 records total, and then we retrive the records from 100 to 119 by visiting below URL:

http://quickbuild:8810/rest/junit/records/tests/103/DEFAULT?offset=100&limit=20

the response looks like:

<report name="tests" version="0.0" locale="en_US">
<row ID="100" packageName="org.hibernate.test.entitymode.multi" className="MultiRepresentationTest" testName="testPojoRetreival" status="PASS" duration="40" hasSysout="true" totalRuns="2" failedRuns="0" passedRuns="2" diffStatus="ADDED"/>
<row ID="101" packageName="org.hibernate.test.entitymode.multi" className="MultiRepresentationTest" testName="testDom4jRetreival" status="PASS" duration="58" hasSysout="true" totalRuns="2" failedRuns="0" passedRuns="2" diffStatus="FIXED"/>
<row ID="102" packageName="org.hibernate.test.entitymode.multi" className="MultiRepresentationTest" testName="testDom4jSave" status="PASS" duration="34" hasSysout="true" totalRuns="2" failedRuns="0" passedRuns="2" diffStatus="FIXED"/>
<row ID="103" packageName="org.hibernate.test.entitymode.multi" className="MultiRepresentationTest" testName="testDom4jHQL" status="PASS" duration="30" hasSysout="true" totalRuns="2" failedRuns="0" passedRuns="2" diffStatus="ADDED"/>

... ...

</report>

If you want to use some filters to filter the records, for example, to retrieve all failed tests, you may:

http://quickbuild:8810/rest/junit/size/tests/103/DEFAULT?filters=(status='ERROR') or (status='FAILURE')

here, we use filter: status='ERROR' or status='FAILURE' , the response is 12, that is, we have 12 failed tests total, and you can retrieve the records now by visiting:

http://quickbuild:8810/rest/junit/records/tests/103/DEFAULT?filters=(status='ERROR') or (status='FAILURE')