Verify column IDs, field names, and Velocity APIs against your installation before promoting the configuration to production.
When to Use This
This pattern is useful whenever a row in Risksheet represents an item that is verified by a Polarion Test Case, and you want each row to surface the most recent test execution result for that item. Typical scenarios:- A requirements + test cases sheet where each requirement row shows the latest pass/fail of its linked test case.
- A safety-controls sheet (ISO 26262, IEC 61508) where each control row must display the latest verification status.
- A V&V traceability matrix that needs an at-a-glance “last result” column for audit purposes.
Prerequisites
Before you start, confirm the following:- Risksheet is embedded in a Polarion LiveDoc and you can edit its sheet configuration.
- Rows in the Risksheet are linked to Test Cases (either directly as the row work item type, or via a link role such as
verifies). - At least one Test Run exists in the project and has been executed against the relevant Test Cases.
- You have permission to edit the sheet configuration and (optionally) the top panel template.
1
Open the Sheet Configuration
- Open the Risksheet document in Polarion.
- From the document menu, choose Menu > Configuration > Edit Risksheet Configuration.
- The YAML editor opens with the current sheet configuration.
2
Add a Server-Rendered Column
The Test Run column is rendered on the server because it needs to call the Polarion test management API for each row. Add a new column to the Key points:
columns section:bindings: task.$item— gives the Velocity template access to the entire linked Test Case work item (not just one field). Use this binding pattern whenever a server-rendered column needs to traverse fields or call services on the linked item.serverRender: lastTestRecord— references a Velocity macro you will define in the next step. The macro name is arbitrary; pick something descriptive.readOnly: true— server-rendered cells cannot be edited, so the flag is implicit, but stating it makes intent clear in audits.
bindings: $item instead and adjust the Velocity macro to operate directly on $item.3
Define the Velocity Macro
The server-rendered column references a Velocity template. By convention, server-render templates live in the top panel configuration (What the macro does:
risksheetTopPanel.vm) so they can be reused across columns.Open the top panel template (Menu > Configuration > Edit Top Panel) and add the following macro:- Calls
$testManagementService.getLastTestRecords($item.getOldApi(), 1)to fetch the most recent test record for the linked Test Case. - Reads the Test Run ID with
getTestRun().getId()and the result enum withgetResult().name(). - Renders the Test Run ID and the result (e.g.
passed,failed,blocked) as a single cell. - Shows a muted placeholder when the Test Case has never been executed.
$testManagementService is part of Polarion’s Velocity context. If the variable is not available in your installation, ask your administrator to confirm it is exposed in the Risksheet top panel scope. The API surface (getLastTestRecords, getResult) follows Polarion’s test management service.4
Save and Refresh
- Save the sheet configuration (the YAML editor validates the syntax on save).
- Save the top panel template if you edited it in step 3.
- Reload the Risksheet document in the browser.
5
Add Conditional Styling (Optional)
To make pass/fail status obvious, colour the cell based on the result. In the sheet configuration:Then attach the decorator to the column:
6
Add the Column to Saved Views (Optional)
If your sheet uses saved views, add the new column to the relevant ones so reviewers see it by default:See Create Saved Views for the full views syntax, including the
@all shorthand and the -columnId exclude prefix.Common Pitfalls
Verification
You should now see, for every Risksheet row that links to a Test Case:- A Last Test Run cell containing the Test Run ID and the result (for example
TR-014 — passed). - Background colour matching the result (green for passed, red for failed, amber for blocked) if you applied the optional decorator from step 5.
- “No execution” in muted grey for Test Cases that have not yet been executed.