如何在空手道反应中进行条件检查? [英] How to do conditional check in karate response?
本文介绍了如何在空手道反应中进行条件检查?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以检查对象是否为空,如果没有,那么再检查是否与固定结构匹配?
Is there any way to check if object is empty then ok if not then check if it matches a fixed structure?
我的意思是,像这样:
* def expectedDelayEntries = response.delayEntries == "{}" ? {} : '#(delayEntries)'
推荐答案
是.请参阅文档: https://github.com/intuit/karate#conditional-logic
分两步进行.
* def expected = condition ? { foo: '#string' } : { bar: '#number' }
* match response == expected
这篇关于如何在空手道反应中进行条件检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文