I am trying to validate a JSON which has multiple JSON objects nested. example
Scenario: temp1
* def response1 =
"""
{
"productGroups": [
{
"dateLabel": "28 Aug, Wed",
"products": [
{
"id": 1439,
"product": "product 1"
},
{
"id": 1401,
"product": "product 2"
}
]
}
]
}
"""
* print response1.productGroups
Then match response1.productGroups[*] contains
"""
{
'dateLabel': #string,
'products': [
{
'id': #number,
'product': #string
}
]
}
"""
Getting the response as
reason: actual value does not contain expected
if I change the validate as
Then match response1.productGroups[0] contains
Getting the response as
reason: actual and expected arrays are not the same size - 2:1
What I wanted to do is verify the schema of "productGroups" object along with the inner objects of "products"
Aucun commentaire:
Enregistrer un commentaire