Skip to main content
This guide adds the execution results of test cases to a sheet. You relate test records to your test case type in the data model, expand them in the sheet’s source, and bind columns to their properties. For what a test record is and how Powersheet reads it, see Test Records.

Prerequisites

  • A sheet configuration and its data model that you can edit in the configuration editor
  • An entity type for your test cases in that data model
  • Test runs in the same project as the sheet, holding records of those test cases — records of test runs in other projects are not read
Nothing here is saved from the sheetTest records are read-only. The sheet shows them and never writes them, so this setup adds no editable cells and no data to save from the sheet.
1

Relate Test Records to the Test Case Type

In the data model, add a relationship between your test case type and TestRecord with storage: TestRecords. No linkRole and no cardinality are needed, and TestRecord does not have to be declared under domainModelTypes:
This gives the test case the navigation property testRecords, and each record the navigation property testRun to the test run that holds it.To use other names, set them on the relationship. direct.name names the navigation on the from type and back.name the one on the to type:
The rest of this guide uses the default name, testRecords.
2

Expand the Records in the Source

In the sheet configuration, expand testRecords under the test case, and testRun beneath it if you want to show which test run each record belongs to:
If your test cases are reached from another type — requirements, for example — put the same testRecords entry under the expand that reaches the test case.
3

Add Columns for the Record

Bind columns to the record’s properties with the testRecords path:
The properties a record offers are result, executed, executedBy, duration and comment. See Data Model Types for what each one holds.
4

Choose How Many Records Each Test Case Shows

Without further configuration, each test case shows its newest record only. To show more of the history, set query.take on the testRecords expand to the number of records to keep per test case:
Records come newest first, so take: 5 keeps the five most recent executions of each test case. A larger count loads more rows for every test case in the sheet, so keep it to the history your users read.

Show the Records of One Test Run

To narrow the sheet to a single test run, filter the testRecords expand by the record’s key to its run, testRunId, which holds the test run’s ID. Reading the value from a URL parameter lets one sheet serve any run:
  • Opened with …&testRun=<test run ID> in the URL, the sheet shows only the records of that run.
  • Opened without the parameter, the condition is dropped and each test case shows its newest record, whichever test run holds it.
  • Every test case stays in the sheet either way. One that the run holds no record of shows no record rows.
A test run can hold several records of one test case. Add take beside the where to see more than the newest of them — the count applies to the records the filter leaves. To filter by a field of the test run instead of its ID, put the where on the testRun expand:
A test run type that the data model does not declare carries only id and title. To filter by another field such as status, declare the type and list the field — see Data Model Types.

Troubleshooting

See Also