首页 文章

'Self' JSON文件中的验证表达式(空手道框架)

提问于
浏览
1

我有两个关于'自我'验证表达式的问题:

  • 问题1

在我的功能中我有

* def isStatus = function(s) { return s ==='SUCCESS' || s ==='ERROR' }
And match response[0] contains { status: '#? isStatus(_)' }

我想对每个响应项(如*(而不是0))执行此操作:

And match response[*] contains { status: '#? isStatus(_)' }

但它不起作用?有什么不对吗?

没有像这个例子中的js函数我不能这样做:

* def date = { month: 3 }
* match date == { month: '#? _ > 0 && _ < 13' }

这不起作用> And match response[*] contains { status: '#? _ == 'SUCCESS' || _ == 'ERROR'' }

  • 问题2:

我有一个json文件,我想存储响应类型 . 但是,当我在我的JSON文件中使用“自我”验证表达式时,它不起作用?谢谢你的帮助 .

1 回答

  • 1

    搜索 match each 的文档 . 试试这个:

    And match each response contains { status: '#? isStatus(_)' }
    

    不能理解q 2,请另外询问 .

相关问题