使用空手道,我试图匹配两个乱序的json数组

时间:2019-02-21 03:32:23

标签: karate

例如

Q Exp

此操作失败,因为数组中元素的顺序不匹配。如何告诉空手道忽略订单?

1 个答案:

答案 0 :(得分:1)

您真的应该阅读以下文档:https://github.com/intuit/karate#match-contains

* def products = [{"ProductCode":"a","UnitPrice":100.0},{"ProductCode":"b","UnitPrice":200.0}]
* def inventory = [{"ProductCode":"b","UnitPrice":200.0},{"ProductCode":"a","UnitPrice":100.0}]
* match products contains only inventory