Karate 空手道正则表达式给出错误-原因:不是字符串
我编写了一个小场景,需要将json键值检查为任意整数。这是我在空手道DSL中的测试步骤:Karate 空手道正则表达式给出错误-原因:不是字符串,karate,Karate,我编写了一个小场景,需要将json键值检查为任意整数。这是我在空手道DSL中的测试步骤: When method get * print response Then match response contains { numberOfElements: '#regex [0-9]+' } 运行时,我得到一个错误: 路径:$.numberOfElements,实际值:8,预期值:“#regex[0-9]+”,原因:不是字符串✽.然后匹配响应包含{numberOfElements:'#regex[
When method get
* print response
Then match response contains { numberOfElements: '#regex [0-9]+' }
运行时,我得到一个错误:
路径:$.numberOfElements,实际值:8,预期值:“#regex[0-9]+”,原因:不是字符串✽.然后匹配响应包含{numberOfElements:'#regex[0-9]+'}
有什么问题吗?要用
整数验证JSON值,键入的值应该是“#number”
#numberOfElements = 8
Then match response contains { numberOfElements: '#number' }
您的方法仅用于检查类型为string
的JSON值是否包含所有数字
#numberOfElements = '8'
Then match response contains { numberOfElements: '#regex [0-9]+' }
提及