Blogs about Jazz

Blogs > Jazz Team Blog >

Handling ETM grid sections in IBM Engineering Lifecycle Optimization – Publishing (PUB)

IBM Engineering Test Management (ETM) offers Grid sections, which are basically tables with a header (columnNames) and one or more rows (values). You can add and remove Grid sections for individual test plans or test cases. In this example, we have a Grid Section to define a set of licenses needed for the given test plan.

Unlike rich text sections, grid sections are not exposed by the schema (qm.xsd). So the first step after adding data source schema in PUB is to edit the schema. Before that, we should discover grid section name. If you do a GET request on the testplan URL, you will find the id of your grid section (dynamicGridSection_1613410049218) in the xml data returned.

To edit the schema in PUB Studio, select “Open Schema in Editor…” by right-clicking on the data source in the Outline view.

At the bottom of the editor, you will see ‘Design’ and ‘Source’ tabs. The ‘Source’ tab is used for XML source editing and the ‘Design’ tab is used for graphical editing. Select the ‘Design’ tab and you should see a top-level view of the XML Schema that summarizes all of the components (e.g. elements and types) that are defined in the schema.

You can drill down on a component of interest by double-clicking on it. For example, if we double click on ‘testplan’, the editor will display the structure of testplan as shown below.

Right-click on the existing section and select ‘Add Element’.

Use the Properties view to change the Name of the element, Minimum Occurance, Maximum Occurrence, Browse and set Type.

Now that you have finished editing the XML Schema, save the file.

There is another challenge in reporting on the grid section. The value of the grid sections returned by ETM is in JSON format and hence needs to be parsed. This JSON contains a title row with column names and one or more value rows:
{"columnNames":["Product","License #"],"value":[[["Camtasia"],["1"]],[["Katalon Studio Enterprise"],["2"]],[["Microsoft Office"],["3"]]]}

This JSON string can be converted to HTML Table using a JavaScript function (Library function).

Printing json2Html(dynamicGridSection_1613410049218) will print the Grid section. Check “XHTML Output” option so that PUB parses the result as XHTML.

Output generated from PUB:

Note: If the Grid Section contains illegal/invalid characters, they need to be replaced/escaped as below:

The sample template can be found here.

Disclaimer: Any code or file accessible or downloadable in this post is provided as is, without warranty of any kind. IBM does not provide support for this.

Subramanya Prasad Pilar
IBM Engineering Lifecycle Optimization – Publishing