Karate 使用空手道,我试图匹配两个顺序错误的json数组
例如Karate 使用空手道,我试图匹配两个顺序错误的json数组,karate,Karate,例如 * 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 == inventory 此操作失败,因为数组中元素的顺序不匹配
* 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 == inventory
此操作失败,因为数组中元素的顺序不匹配。我怎样才能让空手道忽略订单呢?你真的应该阅读文档:
* 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