【发布时间】:2020-01-13 21:22:22
【问题描述】:
JSON Response
{
Feed[
{"item_type":"cycle","id":123},
{"item_type":"computer","name":"mac"},
{"item_type":"Bag","weight":"2"}
]
}
As nested schema is changing based on item type
so can we compare schema based on item type?
example: if item_type is cycle then it should compare with id,
if item_type is computer then it should compare name like this
我尝试过以下方法:
* def schema = {item_type:"#string",id:'##number',name: '##string',weight:'##string'}
在这个模式验证中,即使 item_type 是 cycle 并且 name 是 mac,测试用例也会通过,但实际上它应该会失败
【问题讨论】: