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.

The DMN Test lab

The DMN Test lab

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:

Open the DMN Test lab.

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.

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.

    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.

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).

    Specify the expected output value(s)

After you have created all necessary cases, you can save them by clicking the Save button.

Note

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.

Delete a test case.

Delete a test case.

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.

Undefined, passing and failing test cases

Undefined, passing and failing test cases

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 tool 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:

Open a test case in the simulation tool.

Open a test case in the simulation tool.

Then, the simulation tool applies the input data of your test case automatically.

Importing and exporting test cases

Important

You need to save test cases in order to be able to export them.

It is possible to export and import test cases as JSON (JavaScript Object Notation) files. This enables you to keep the test cases when transferring diagrams between Signavio workspaces. To be able to import or export test cases, all cases that were created before must be saved first. In order to export test cases for a diagram, open the Test lab and click the Export button in the test management interface:

Export test cases.

Export test cases.

A .json file containing the test cases will be downloaded.

For importing test cases click the Import button in the test management interface:

Import test cases.

Import test cases.

Now, select the .json file you want to import and click Open.