08. Customize The Report

QuickBuild 2.0 Documentation

The QuickBuild has a very flexible reporting system, and most of the build reports supported by QuickBuild are generated and rendered by defining an XML configuration. You can change the definitions in the report plugin setting to create customized report or to change the look-and-feel of the reports itself. You can also create a very simple plugin and  write the XML definition in the plugin setting to add a new kind of report not yet supported in QuickBuild.

As XML report setting definitions are case sensitive, you should be careful to use the upper and lower case of the words, otherwise QuickBuild may ignore some elements you have defined.

Concepts of QuickBuild Report

QuickBuild report is like a table in a database system that includes data rows and data columns. All data columns are defined in report meta data, which is the schema of a report. All data will be stored as a XML file in QuickBuild. The relationship between reports is retrieved from the primary columns defined in the report meta data. Following shows a typical QuickBuild report:

<?xml version="1.0" encoding="UTF-8"?>

<testcase version="1.0">
  <row id="0" name="testMerging" status="success" time="18"/>
  <row id="1" name="testHandSQL" status="success" time="26"/>
  <row id="2" name="testSerializationOnAfterStatementAggressiveRelease" status="success" time="44"/>
  <row id="3" name="testSerializationFailsOnAfterStatementAggressive" status="success" time="27"/>
  <row id="4" name="testQueryIteration" status="success" time="29"/>
.... ......
</testcase>

To create a QuickBuild report, we will define a report generator to tell QuickBuild how to create the report.

After generating a report, you also need to define a report renderer so QuickBuild can render the report to HTML and the report can be displayed by web browser.

In QuickBuild, there are two kinds of report, one is for build, we call it Build Report, and another is for statistics, we call it Statistics Report. Both of them use the concepts we just described. The Build Report will be rendered in the Builds Tab, and the Statistics Report will be rendered in the Statistics Tab.

The Build Report is used to show  build specific data, while the Statistics Report is used to gather the statistics data from the Build Report. You can then follow the trends of the build data in the Statistics Report.

Report Category

In QuickBuild, reports are categorized into a category. For example, we can categorize all JUnit related reports together into JUnit Report Category. Normally, one report plugin contains one report category. The definition of a report category can be viewed/customized in the plugin setting (you may need be authorized to do so).
ScreenShot for TestNG Report Plugin Setting

As the screenshot shows, the report category contains:

Field Name Description
Category Name The name of the report category, this will be used as the navigation menu in build tab.
Version The version of current defintion. The version may be used during QuickBuild upgrade.
Ordinal Number QuickBuild sorts the order of reports by it in build tab and statistics tab. The smaller number, the higer position.
Meta Data Of Build Reports All the definitions of build report meta data Surrounded by <metas> element.
Generators of Build Reports All the definitions of build report generators. Surrounded by <generators> element, if applicable.
Renderers of Build Reports All the definitions of build report renderers. Surrounded by <renderers> element, if applicable.
Build Dashboard Setting The definition for build dashboard, if applicable.
Meta data of Statistics The statistics report defintion Surrounded by <metas> element, if applicable.
Generators of Statistics The generator defintion for statistics reports Surrounded by <generators> element, if applicable.
Renderer of Statistics The renderer definition for the statistics reports Surrounded by <renderers> element, if applicable.

DataRow

The data stored in QuickBuild Report is a set of data rows. Each data row is a record of the report. In many situations, you need to retrieve the data from a data row. For example, when you generate the report, you need to retrieve the value of 'errors' column, so that you can set the value of column 'status', or when you are using velocity template to render the page, you also need to retrieve the appropriate values of the report columns. Following are the frequently used functions:

Function Description
getValue(String columnName) The getValue function is used in many cases, by giving the name of a column, you can retrieve the data from a row.
getValue(Integer columnIndex) The index of a column (the index is zero-based). The index number is based on the order you define in the column in report meta data.
getValueAsString(String columnName) Retrieve the data and format it as String using the default format.
getValueAsString(String columnName, String format) Retrieve the data and format it as String using the specific format.
getValueAsString(String columnName, boolean wordwrap, int length) Retrive the data as string value and break the words according to the length specified. If the wordwrap set to 'true', the whole string will be wrapped, if the wordwrap set to 'false', then the string value will be truncated from the first word.

In most cases you do not need to invoke the 'setValue' functions directly, QuickBuild will do it for you.

Labels

 
(None)