彼得为我提供了一个使用空手道 0.9.3 来应用示例中的断言的解决方案
我想知道是否可以从请求而不是完整请求中声明一个值。
**Background:**
* configure headers = read('classpath:merchantServiceheaders.js')
Given url MservUrl
And path 'XXXXXX'
And request Data
When method POST
Then status 200
And match response != null
And match $ contains {serviceName: 'XXXXX'Service', responseMessage:
'Success' }
And match each $.clauses..responseMessage == 'Success'
And match each $..predicate != null
And match each $..predicate == '#present'
And match each $..predicate == '#regex [^0-9]+[0-9]*$'
And match $..predicate contains Data.clauses.subject
Examples:
|Data! |
|'{"clauses":[{"subject":"XXXX","predicate":"999999"},
{"subject":"XXXXX","predicate":"99999"}]}'|
Run Code Online (Sandbox Code Playgroud)
我想要做的是在And match $..predicate contains …
karate ×1