Guide / Draw and edit
DMN tests
Save the inputs and the expected outputs of a decision table as test cases, run them in the editor or in a pipeline, and see which rules no case reaches.
What it is
A test case says: for these inputs the decision must give these outputs. Penstock keeps the cases of a decision table next to the DMN file and runs them with the same evaluation the Try tab uses. Each result names the rules that matched, and a rule coverage block lists the rules no case reaches.
The Tests tab
The Tests tab of the DMN editor sits after Try in the sidebar. It lists the saved cases of the selected decision table, or of a decision with required decisions, as a table with the inputs, the expected outputs, the name and the status.
- Run all runs every case. Each row can also be run alone.
- Each row names the rules that matched. When a case fails, the row shows what was expected against what came out, with use the actual result as expected.
- Save as test in the Try tab keeps the values you typed and the result as a new case.
- The rule coverage block lists the rules no case reaches, counted for the hit policy of the table. Add case from rule N starts a case for a rule that is not covered yet.
Running is free with no time limit for 3 cases per decision. More cases are part of Pro.
The test file
Cases are kept in <name>.dmn.tests.json, next to the DMN file. The file carries a schema version, reads well in a diff and has a generated JSON schema, penstock-dmn-tests.schema.json.
In a terminal
penstock test dmn decisions --min-rule-coverage 80 --format junit
| Option | What it does |
|---|---|
<file|folder> | A DMN file or a folder. It runs the saved cases of every decision table in it. |
--format text|json|junit | How the answer is printed. |
--min-rule-coverage <percent> | Fails when the rule coverage is below this percentage, from 0 to 100. |
It exits 0 when every case passed and the coverage, when one was asked for, is met. It exits 1 when a case failed or could not be evaluated, a file could not be read, the coverage is below the minimum, or the run is not allowed here.
A local run of up to 3 cases per decision is free. The junit output, --min-rule-coverage and any run in a pipeline are part of Pro and Team in a pipeline. See Every command.
For an AI agent
The test_dmn MCP tool runs and reads the cases for an agent. Saving a case through it is a Pro write. See The MCP server.
What you see
- A Tests tab with a status for each case and a coverage block.
- A
<name>.dmn.tests.jsonfile beside the decision file.
Common problems
- A case beyond the third is not run.
- The free run covers 3 cases per decision. More cases need Pro.
- The command exits 1 with the coverage below the minimum.
- Open the Tests tab and read the rules no case reaches. Add case from rule N starts one.