The DMN Test lab
The DMN Test lab enables you to define and run test cases in order to check whether a DMN diagram fulfills certain requirements.
This is helpful in order to ensure that diagrams are still consistent with initial decision logic after being extended or to control the correctness of specific input combinations and outputs in complex diagrams.
To open the Test lab, select the diagram you want to test in the Explorer and click Edit, then Test DMN diagram in the top drop-down menu:
Alternatively, you can open the DMN diagram in the Editor and switch to the Test lab via the drop-down menu in the upper right corner and vice versa:
Switch from the Editor to the DMN Test lab.
Creating test cases
In order to create a new test case, proceed as follows:
Create a new test case by clicking the '#' sign left of the test cases table:
Create a new test case
- Click one of the test case's columns to define all its values. A drop-down dialog opens and you can enter the necessary information. Then, click Apply:
Specify the input data of your test case.
Now, click the column that shows the calculated value in red in the Result column on the right and specify the expected output value(s):
Specify the expected output value(s)
After you have created all necessary cases, you can save them by clicking the Save button.
To delete a test case, it must be saved first. Simply click onto the number of the saved test case(s) you would like to remove, then click Save.
Each test case is automatically executed as soon as a parameter is changed.
In the following simple case, we want to determine a discount. The only input parameter here is the purchase value. In the first test case, no value is given for the expected result as indicated by the red X on the left in the result column. In the second case, the actual discount corresponds with the expected result as indicated by the green check mark icon. In the third case. the expected result is different from the actual result, as indicated, again, by the red X.
Inspecting test cases in the simulation tool
Often, you want to find out why a test case is producing a certain output. With the DMN simulation you can inspect a decision's behavior, for example to see exactly which rules fire for your input data set. To open the simulation tool, select a test case and click Inspect in Simulation:
Then, the simulation tool applies the input data of your test case automatically.
Importing and exporting test cases
You need to save test cases in order to be able to export them.
A .json file containing the test cases will be downloaded.
For importing test cases click the Import button in the test management interface:
Now, select the .json file you want to import and click Open.