空手道 - 匹配 2 JSON 个对象的值,但将正则表达式应用于对象的一个元素
Karate - Matching 2 JSON objects for values but applying regex to one element of objects
我有2个json如下:
a: [{"code":"00","name":"A","iconUrl":"https:env1.test.png"}, {"code":"01","姓名":"B"}]
b: [{"iconUrl":"https:env2.test.png", "code":"00","name":"A"}, {"code":"01","姓名":"B"}]
我想比较 2 个 json 对象。我试过匹配只包含。
由于 iconUrl 中的 env1 和 env2 不匹配,我的测试失败了。有没有办法通过对 iconUrl 应用正则表达式而不影响代码和数字的验证来解决它?
有很多种可能的方式,这里是一种:
* def first = [{"code":"00","name":"A","iconUrl":"https:env1.test.png"}, {"code":"01","name":"B"}]
* def second = [{"iconUrl":"https:env2.test.png", "code":"00","name":"A"}, {"code":"01","name":"B"}]
* second[0].iconUrl = '#string'
* match first == second
我有2个json如下:
a: [{"code":"00","name":"A","iconUrl":"https:env1.test.png"}, {"code":"01","姓名":"B"}]
b: [{"iconUrl":"https:env2.test.png", "code":"00","name":"A"}, {"code":"01","姓名":"B"}]
我想比较 2 个 json 对象。我试过匹配只包含。
由于 iconUrl 中的 env1 和 env2 不匹配,我的测试失败了。有没有办法通过对 iconUrl 应用正则表达式而不影响代码和数字的验证来解决它?
有很多种可能的方式,这里是一种:
* def first = [{"code":"00","name":"A","iconUrl":"https:env1.test.png"}, {"code":"01","name":"B"}]
* def second = [{"iconUrl":"https:env2.test.png", "code":"00","name":"A"}, {"code":"01","name":"B"}]
* second[0].iconUrl = '#string'
* match first == second