JSON Test File

Test collection

Parameters

Example

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

Test

Parameters

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

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

Example

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

Parameter

Parameters

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

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

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

Example

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

File value

Parameters

Example

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

Action exception

Parameters

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