问题描述
* def responseJson =
"""
{
"name": "John","age": 30,"cars": {
"car1": "Ford","car2": "BMW","car3": "Fiat"
},"bikes": {
"bike1": "b1","bike2": "b2","bike3": "b3"
}
}
"""
问题:我想比较json的一部分。我试图利用空手道的“包含” dsl,但没有成功。下面的代码参考:
def expectedJson1 =
"""
{
"car1": "#string","car2": "#string","car3": "#string"
}
"""
* def expectedJson2 =
"""
{
"car1": "#string","car2": "#string"
}
"""
* def expectedJson3 =
"""
{
"car1": "#string"
}
"""
* match responseJson contains '#(^expectedJson1)'
* match responseJson contains '#(^expectedJson2)'
* match responseJson contains '#(^expectedJson3)'
我不想使用json路径进行键/值比较,因为实际响应json读取起来相当复杂。因此想随机进行部分匹配。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)