JSON Test File

Test collection

Parameters

Parameter

Type

Description

processName

String

Name of the process for which you want to run a test

processVersion

Int

Version of the process for which you want to run a test

tests

List of tests to be run

You can define one or several tests in this array.

deleteRequest

Boolean

Indicates whether you want to delete requests that will be launched once the tests have been run

Example

{
    "processName": "TEST_PROCESS",
    "processVersion": 1,
    "tests": [...],
    "deleteRequest": false
}

Test

Parameters

Parameter

Type

Description

describe

String

Description of the test

requestParameters

List of parameters that will be transmitted upon launching the request

You can define one or several parameters in this array.

actions

List of actions that will be covered by the test

You can define one or several actions in this array.

assertions

Checks to be performed on the request created during the test

Example

"tests": [
    {
        "describe": "First test",
        "requestParameters": [...],
        "actions": [...],
        "assertions": {...}
    },
    {
        "describe": "First test",
        "requestParameters": [...],
        "actions": [...],
        "assertions": {...}
    }
]
            

Action

Test actions will be run in the order that you define.

Parameters

Parameter

Type

Description

name

String

Action ID

operation

Enum

Type of action that will be executed

Possible values: COMPLETE, CHECK, SUBPROCESS , orCANCEL.

timeout

Int

Maximum time for execution of the action

parameters

List of parameters that will be transmitted upon launching the request

You can define one or several parameters in this array.

subRequestFile

String

Path to the sub request's JSON test file

subRequest

Elements of the sub request

assertions

Checks to perform on the action

exception

Throw an exception when performing an action

Example

"actions": [
    {
        "name": "INITIATES",
        "operation": "COMPLETE",
        "parameters": [...],
        "assertions": {...}
    },
    {
        "name": "COPY_DATA",
        "operation": "CHECK",
        "timeout": 10,
        "assertions": {...}
    },
    {
        "name": "SUBTEST_PROCESS",
        "operation": "SUBPROCESS",
        "subRequestFile": "./Resource/Process/Test/subprocessjson.json",
        "assertions": {...}
    }
]

The content of the sub request file includes only the actions that will be performed.

An example of this content is provided in the Usage example section.

Sub request

Parameters

Parameter

Type

Description

actions

List of actions that will be covered by the test

You can define one or several actions in this array.

assertions

Checks to be performed on the sub-request created during the test

Example

"subRequest": {
    "actions": [...]
},
"assertions": {...}

Parameter

Parameters

Parameter

Type

Description

name

String

Name of the data

numericValue

Float

Numeric value of the data

textValue

String

Text value of the data

dateTimeValue

String

Date/time value of the data

fileValue

File type value of the data

Examples

📌 Example of Test request parameters

"requestParameters": [
    {
        "name": "IN_TEXT",
        "textValue": "Text"
    },
    {
        "name": "IN_NUMERIC",
        "numericValue": 11.1
    },
    {
        "name": "IN_DATETIME",
        "dateTimeValue": "1977-04-22T06:00:00Z"
    },
    {
        "name": "IN_FILE",
        "fileValue": {...}
    }
]

📌 Example of Test action parameters

"parameters": [
    {
        "name": "IN_TEXT",
        "textValue": "Text"
    },
    {
        "name": "IN_NUMERIC",
        "numericValue": 11.1
    },
    {
        "name": "IN_DATETIME",
        "dateTimeValue": "1977-04-22T06:00:00Z"
    },
    {
        "name": "IN_FILE",
        "fileValue": {...}
    }
]

Action assertions

Parameters

Parameter

Type

Description

status

Enum

Expected completion status of the action to be performed

Possible values: OPEN or CLOSED

substatus

Enum

Expected sub status completion of the action that will be performed

Possible values: COMPLETED, ABORTED, RUNNING, or NOT_RUNNING_NOT_STARTED

data

List of data to check for the tested action

The assertions node checks whether the data returned by the action is exactly the same as that specified in its parameters. If they don't match, the test will be evaluated as having failed.

Example

"assertions": {
    "status": "CLOSED",
    "subStatus": "COMPLETED",
    "data": [...]
}

Request assertions

Parameters

Parameter

Type

Description

completedActionCount

Int

Expected number of completed actions

status

Enum

Expected completion status of the request created during the test

Possible types: OPEN or CLOSED

substatus

Enum

Expected completion status of the request created during the test

Possible types: COMPLETED, ABORTED, RUNNING, or NOT_RUNNING_NOT_STARTED

data

List of data to check for the request created during the test

The assertions node checks whether the data returned by the request created during the test is exactly the same as that specified in its parameters. If they don't match, the test will be evaluated as having failed.

Example

"assertions": {
    "completedActionCount": 3,
    "requestStatus": "CLOSED",
    "requestSubStatus": "ABORTED",
    "requestData": [...]
}

Data

Parameters

Parameter

Type

Description

name

String

Name of the data

numericValue

Float

Numeric value of the data

textValue

Chaîne

Text value of the data

dateTimeValue

Chaîne

Date/time value of the data

Example

"requestData": [
    {
        "name": "REQUEST_SUBJECT",
        "textValue": "OK"
    },
    {
        "name": "COPYDATA_VALUE",
        "textValue": "OK"
    }
]

File value

Parameters

Parameter

Type

Description

name

String

File name, including its extension

description

String

Description of the file

content

String

Content of the file encoded in base64

contentType

String

File content type

size

Int

File size in MB

Example

"fileValue": {
    "content": "R3JhcGhRTCBGaWxl",
    "contentType": "plain/text",
    "description": "desc",
    "name": "test.txt",
    "size": 12
}

Action exception

Parameters

Parameter

Type

Description

type

Enum

Type of exception to send

Possible values: ERROR or CANCEL

message

String

Error message to send to the action

source

String

Source of the exception to send to the action

Example

"exception": {
    "type": "ERROR",
    "message": "Message",
    "source": "Source"
}

Usage example

The process test command is based on a json file. This definition document allows you to define the flows that will be executed for your tests and the expected results. It consists of 10 different aspects.

Here's the workflow that we'll use for the explanations:

Test file

This is the content of the parent process test file:

{
    "processName": "TEST_PROCESS",
    "processVersion": 1,
    "tests": [
        {
            "describe": "First test",
            "requestParameters": [],
            "actions": [
                {
                    "name": "INITIATES",
                    "operation": "COMPLETE",
                    "parameters": [
                        {
                            "name": "REQUEST_SUBJECT",
                            "textValue": "OK"
                        }
                    ],
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "COMPLETED"
                    }
                },
                {
                    "name": "COPY_DATA",
                    "operation": "CHECK",
                    "timeout": 10,
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "COMPLETED",
                        "data": [
                            {
                                "name": "COPYDATA_VALUE",
                                "textValue": "OK"
                            }
                        ]
                    }
                },
                {
                    "name": "SUBTEST_PROCESS",
                    "operation": "SUBPROCESS",
                    "subRequestFile": "./Resource/Process/Test/subprocessjson.json",
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "COMPLETED"
                    }
                }
            ],
            "assertions": {
                "completedActionCount": 3,
                "requestStatus": "CLOSED",
                "requestSubStatus": "COMPLETED",
                "requestData": [
                    {
                        "name": "REQUEST_SUBJECT",
                        "textValue": "OK"
                    },
                    {
                        "name": "COPYDATA_VALUE",
                        "textValue": "OK"
                    }
                ]
            }
        },
        {
            "describe": "Second test",
            "requestParameters": [],
            "actions": [
                {
                    "name": "INITIATES",
                    "operation": "COMPLETE",
                    "parameters": [
                        {
                            "name": "REQUEST_SUBJECT",
                            "textValue": "OK"
                        }
                    ]
                },
                {
                    "name": "COPY_DATA",
                    "operation": "CHECK",
                    "timeout": 10,
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "COMPLETED",
                        "data": [
                            {
                                "name": "COPYDATA_VALUE",
                                "textValue": "OK"
                            }
                        ]
                    }
                },
                {
                    "name": "SUBTEST_PROCESS",
                    "operation": "SUBPROCESS",
                    "subRequest": {
                        "actions": [
                            {
                                "name": "INITIATES",
                                "operation": "COMPLETE",
                                "parameters": [
                                    {
                                        "name": "REQUEST_SUBJECT",
                                        "textValue": "OK"
                                    }
                                ]
                            },
                            {
                                "name": "VALIDATES",
                                "operation": "COMPLETE",
                                "parameters": [
                                    {
                                        "name": "APPROVAL_DECISION",
                                        "textValue": "MORE_INFO"
                                    }
                                ]
                            },
                            {
                                "name": "UPDATES",
                                "operation": "COMPLETE",
                                "timeout": 5,
                                "parameters": [
                                    {
                                        "name": "REQUEST_SUBJECT",
                                        "textValue": "OK"
                                    }
                                ]
                            },
                            {
                                "name": "VALIDATES",
                                "operation": "COMPLETE",
                                "parameters": [
                                    {
                                        "name": "APPROVAL_DECISION",
                                        "textValue": "YES"
                                    }
                                ]
                            }
                        ]
                    },
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "COMPLETED"
                    }
                }
            ],
            "assertions": {
                "completedActionCount": 3,
                "requestStatus": "CLOSED",
                "requestSubStatus": "COMPLETED",
                "requestData": [
                    {
                        "name": "REQUEST_SUBJECT",
                        "textValue": "OK"
                    },
                    {
                        "name": "COPYDATA_VALUE",
                        "textValue": "OK"
                    }
                ]
            }
        },
        {
            "describe": "Third test",
            "requestParameters": [],
            "actions": [
                {
                    "name": "INITIATES",
                    "operation": "COMPLETE",
                    "parameters": [
                        {
                            "name": "REQUEST_SUBJECT",
                            "textValue": "OK"
                        }
                    ]
                },
                {
                    "name": "COPY_DATA",
                    "operation": "CHECK",
                    "timeout": 10,
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "COMPLETED",
                        "data": [
                            {
                                "name": "COPYDATA_VALUE",
                                "textValue": "OK"
                            }
                        ]
                    }
                },
                {
                    "name": "SUBTEST_PROCESS",
                    "operation": "SUBPROCESS",
                    "subRequest": {
                        "actions": [
                            {
                                "name": "INITIATES",
                                "operation": "COMPLETE",
                                "parameters": [
                                    {
                                        "name": "REQUEST_SUBJECT",
                                        "textValue": "OK"
                                    }
                                ]
                            },
                            {
                                "name": "VALIDATES",
                                "operation": "CANCEL",
                                "exception": {
                                    "type": "ERROR",
                                    "message": "Message",
                                    "source": "Source"
                                },
                                "assertions": {
                                    "status": "CLOSED",
                                    "subStatus": "ABORTED"
                                }
                            }
                        ]
                    },
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "ABORTED"
                    }
                }
            ],
            "assertions": {
                "completedActionCount": 3,
                "requestStatus": "CLOSED",
                "requestSubStatus": "ABORTED",
                "requestData": [
                    {
                        "name": "REQUEST_SUBJECT",
                        "textValue": "OK"
                    },
                    {
                        "name": "COPYDATA_VALUE",
                        "textValue": "OK"
                    }
                ]
            }
        },
        {
            "describe": "Fourth test",
            "requestParameters": [],
            "actions": [
                {
                    "name": "INITIATES",
                    "operation": "COMPLETE",
                    "parameters": [
                        {
                            "name": "REQUEST_SUBJECT",
                            "textValue": "OK"
                        }
                    ]
                },
                {
                    "name": "COPY_DATA",
                    "operation": "CHECK",
                    "timeout": 10,
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "COMPLETED",
                        "data": [
                            {
                                "name": "COPYDATA_VALUE",
                                "textValue": "OK"
                            }
                        ]
                    }
                },
                {
                    "name": "SUBTEST_PROCESS",
                    "operation": "SUBPROCESS",
                    "subRequest": {
                        "actions": [
                            {
                                "name": "INITIATES",
                                "operation": "COMPLETE",
                                "parameters": [
                                    {
                                        "name": "REQUEST_SUBJECT",
                                        "textValue": "OK"
                                    }
                                ]
                            },
                            {
                                "name": "VALIDATES",
                                "operation": "CANCEL",
                                "assertions": {
                                    "status": "CLOSED",
                                    "subStatus": "ABORTED"
                                }
                            }
                        ]
                    },
                    "assertions": {
                        "status": "CLOSED",
                        "subStatus": "ABORTED"
                    }
                }
            ],
            "assertions": {
                "completedActionCount": 3,
                "requestStatus": "CLOSED",
                "requestSubStatus": "ABORTED",
                "requestData": [
                    {
                        "name": "REQUEST_SUBJECT",
                        "textValue": "OK"
                    },
                    {
                        "name": "COPYDATA_VALUE",
                        "textValue": "OK"
                    }
                ]
            }
        }
    ],
    "deleteRequest": false
}

subRequestFile

This is the content of the subprocessjson.json test file, used in the first test for the SUBTEST_PROCESS action:

{
    "actions": [
        {
            "name": "INITIATES",
            "operation": "COMPLETE",
            "parameters": [
                {
                    "name": "REQUEST_SUBJECT",
                    "textValue": "OK"
                }
            ]
        },
        {
            "name": "VALIDATES",
            "operation": "COMPLETE",
            "parameters": [
                {
                    "name": "APPROVAL_DECISION",
                    "textValue": "YES"
                }
            ]
        }
    ]
}

Last updated