Hi,
I want to add an assertion to check whether the array in the response body match with a JSON file
In the below example, I have an array “ErrorCode” with 3 elements (in reality, there are a lot of returned data so I wanna use a data file (JSON,CSV) and use Run Collection to check faster)
I want to check whether the array in the response body matches with a JSON file. How could I do that?
A. Json file as below:
Blockquote
{
“ErrorCode”:[
{
“Id”:1,
“CodeCategory”:null,
“CodeName”:“ErrCodeA”,
“Removal_flag”: true
},
{
“Id”:2,
“CodeCategory”:null,
“CodeName”:“ErrCodeB”,
“Removal_flag”: false
},
{
“Id”:3,
“CodeCategory”:null,
“CodeName”:“ErrCode3”,
“Removal_flag”: true
}
]
}
Blockquote
B. Response body as below:
Blockquote
{
“ErrorCode”:[
{
“Id”:1,
“CodeCategory”:null,
“CodeName”:“ErrCode1”,
“Removal_flag”: false
},
{
“Id”:2,
“CodeCategory”:null,
“CodeName”:“ErrCode2”,
“Removal_flag”: false
},
{
“Id”:3,
“CodeCategory”:null,
“CodeName”:“ErrCode3”,
“Removal_flag”: true
}
]
}
Blockquote
Thanks in advance.