我的测试数据:
{
"staffId": 1691580015,
"staffName": "Test Staff",
"staffEmail": "teststaff@perpule.com",
"isAdmin": null,
"isSuperAdmin": null,
"shopDetails": [
{
"shopId": 5004,
"shopName": "Spar E2E",
"shopAddress": "Nagpur",
"shopLocality": "Nagpur",
"shopCity": "Nagpur",
"shopState": "Maharashtra",
"stateCode": "KT"
}]
}
我的测试用例代码:
var schema = {
//"required":["shopDetails"],
"type":"object",
"properties":{
"shopDetails":{
"type":"array",
"items":[
{
"type":"object",
"properties":{
"shopId":{
"type":"integer"
},
"shopName":{
"type":"string"
},
"shopAddress":{
"type":"string"
}
}
}
]
}
}
}
//console.log(JSON.stringify(tv4));
pm.test('Schema is valid', function() {
pm.expect(tv4.validate(jsonData, schema)).to.be.true;
});
问题是每次失败,如何解决请帮忙?