json 使用空手道驱动的数据来检查 arraylist 中的所有对象

How to check all objects from arraylist is present in json using data driven in karate

两个 json 文件如下。想要一一检查所有数组列表是否存在“响应”json 中的“数据”。即数据中的第一个列表 {a : aa, b : 2} 出现在“响应”中,然后是数据中的第二个列表 {a : bb, b : 5},依此类推。 json 都是动态的。所以每次 jsons 的长度和包含(键值)都会改变。

def response = [{a : aa, b : 2, c : 4}, {a : bb, b : 5, d : 1, e : 1}, {a : cc, b : 5}……]

data = [{a : aa, b : 2}, {a : bb, b : 5}]

尝试了很多但没有成功请帮助我.........!

  1. 下面在 * match 语句
  2. 上抛出错误 Expected an operand but found <
Scenario Outline: Verify all list from arraylist is present in json
* def response = [{a : aa, b : 2, c : 4, d : 1, e : 1}, {a : bb, b : 5, d : 1, e : 1}, {a : cc,   b : 5, d : 1, e : 1}……]
* match response contains '#(^<data>)'

    Examples:
      | data|
  1.  * match response contains deep data   
    

引发错误 <eval>:1:5 Expected ; but found data

这是空手道中的一行:https://github.com/intuit/karate#match-contains-deep

* match response contains deep data