Structure of a Test Case File

Learn how the input and output parameters make up the structure of a test case, reference the definitions of available input and output parameters, and check the different data types of a value.

Test case file structure

{
    "inputParameterDefinitions": [
        {
            "id": "DIAGRAM_ID/SHAPE_ID",
            "shapeId": "SHAPE_ID",
            "diagramId": "DIAGRAM_ID",
            "modelName": "MODEL_NAME",
            "requirementName": "INPUT_DATA_NAME"
        },
        ...
    ],
    "outputParameterDefinitions": [
        {
            "id": "DIAGRAM_ID/SHAPE_ID",
            "shapeId": "SHAPE_ID",
            "diagramId": "DIAGRAM_ID",
            "modelName": "MODEL_NAME",
            "requirementName": "TOP_LEVEL_DECISION_NAME"
        },
        ...
    ],
    "testCases": [
        {
            "inputValues": [
                {
                    "type": "number|string|date|time|datetime|boolean|complex|enumeration|hierarchy|list",
                    "value": "INPUT_VALUE"
                },
                ...
            ],
            "expectedValues": [
                {
                    "type": "number|string|date|time|datetime|boolean|complex|enumeration|hierarchy|list",
                    "value": "OUTPUT_VALUE"
                }
            ]
        },
        {
            <ANOTHER TEST CASE>
        },
        {
            <ANOTHER TEST CASE>
        },
        ...
    ]
}

Definition of input and output parameters

Element

Description

Type

  • inputParameterDefinitions

  • outputParameterDefinitions

Top level

Array of definition objects for input or output parameters

id

Specifies the ID of the parameter definition

The ID is composed of the diagram ID and the shape ID as follows: diagramID/shapeID

String

shapeId

Specifies the ID of the shape

To find the shape ID, open the DMN diagram in the editor and expand the attributes panel. Under More Attributes, the shape ID is listed as Element ID.

String

diagramId

Specifies the ID of the DMN diagram

The diagram ID is part of the URL when opening the DMN diagram in the editor, for example id=343056b7ce194785b04efab05cfa92a9 from the URL https://<your_workspace>.signavio.com/p/editor?id=343056b7ce194785b04efab05cfa92a9.

String

modelName

Specifies the title of the diagram as specified in the editor

This element is ignored during import.

String

requirementName

For inputParameterDefinitions: Specifies the shape name of an input data element.

For outputParameterDefinitions: Specifies the shape name of the top-level decision element.

This element is ignored during import.

String

List of test cases

Element

Description

Type

testCases

Top level

Test cases object

inputValues

Specifies the input data

inputValues is bound to the input data via the section inputParameterDefinitions. The order defines the binding: the first element in inputValues is passed as value to the input data corresponding to the first element in inputParameterDefinitions.

Array of input value objects, read more in section Objects for input and output values.

expectedValues

Specifies the expected output data

expectedValues is bound to the decision output via the section outputParameterDefinitions. The order defines the binding: the first element in expectedValues is passed as value to the output data corresponding to the first element in outputParameterDefinitions.

Array of output value objects, read more in section Objects for input and output values.

Objects for input and output values

Element

Description

Type

Notes

  • inputValues

  • expectedValues

Top level

Array of input or output value objects

type

Specifies the data type of the input or output value

String

Valid values:

  • number

  • string

  • date

  • time

  • datetime

  • boolean

  • complex

  • enumeration

  • hierarchy

  • list

value

Specifies the actual input or output value

String

The data types "number", "string", and "boolean" correspond to standard JSON data types.

Values of type "date" must be represented as ISO formatted strings, for example "2015-12-31".

Values of type "time" must be represented as ISO formatted string, for example "T23:59:59Z" or "T23:59:59-02:00".

Values of type "datetime" must be represented as ISO formatted string, for example "2015-12-31T23:59:00-02:00".

For values of type "list", read more in section List value. Nesting lists is not supported.

For values of type "complex", read more in section Complex value.

For values of type "enumeration", read more in section Enumeration Value.

For values of type "hierarchy", read more in section Hierarchy Value.

List value

JSON example:

{
  "type" : "list",
  "value" : [ {
    "type" : "number|string|date|time|datetime|boolean|complex|enumeration|hierarchy",
    "value" : "INPUT_VALUE"
  }, {
    "type" : "number",
    "value" : "INPUT_VALUE"
  }, {
  ...
  } ]
}

Element

Description

Type

type

Specifies the data type of a value.

Value must be "list".

String

value

Specifies the list value objects

Array of value objects, read more in section Objects for input and output values.

Nesting lists is not supported.

Complex Value

JSON example:

{
  "type" : "complex",
  "slots" : [ {
    "id" : "0",
    "value" : {
      "type" : "number|string|date|time|datetime|boolean|complex|enumeration|hierarchy|list",
      "value" : "INPUT_VALUE",
    }
  }, {
    "id" : "1",
    "value" : {
      "type" : "number|string|date|time|datetime|boolean|complex|enumeration|hierarchy|list",
      "value" : "INPUT_VALUE",
    }
  }, {
  ...
  } ]
}

Element

Description

Type

type

Specifies the type of a value

Value must be "complex".

String

slots

Specifies the attributes of the complex type definition

Array of attribute objects

id

Reference to the value of the data type definition

Since attributes can be renamed and reordered, the name or the order as shown in the editor can be misleading. IDs are assigned when a new attribute is created. Renaming and reordering doesn't change the attribute's ID. To determine the correct ID, export an example test case for each value.

String

value

Specifies the actual value for the attribute

Value object, read more in section Objects for input and output values

Enumeration Value

JSON example:

{
  "type" : "enumeration",
  "value" : "0"
}

Element

Description

Type

type

Specifies the data type of a value

Value must be "enumeration".

String

value

Specifies the ID of the value of the data type definition

Since enumeration values can be renamed and reordered, the name or the order as shown in the editor can be misleading. IDs are assigned when a new enumeration value is created. Renaming and reordering doesn't change the enumeration value's ID. To determine the correct ID, export an example test case for each value.

String

Hierarchy Value

JSON example:

{
  "type" : "hierarchy",
  "value" : [ "1", "4" ],
}

Element

Description

Type

type

Specifies the data type of a value

Value must be "hierarchy".

String

value

Specifies a list of IDs according to the data type definition, constructing the path from the root of the hierarchy to the referenced element

Since hierarchy values can be renamed and reordered, the name or the order as shown in the editor can be misleading. IDs are assigned when a new hierarchy value is created. Renaming and reordering doesn't change the hierarchy value's ID. To determine the correct ID, export an example test case for each value.

Array of positional IDs