重试,直到对karatedsl不满意

时间:2019-01-07 10:13:27

标签: karate

我有两个文件,第一个用于a.feature包含

Feature: xxx
Scenario Outline: xxx 
* call read('../../RunnerFeature/RunnerMobile.feature') {"customer_id":<customer_id>, "RC":<RC>,"id":<id>,"product_code":<product_code>}
Examples:
|"081290070020"|'00'|16|"1"|

和其他文件b.feature包含:

Scenario: get detail transaction
Given path '/transaction/' + response.transaction_id + ".json"
And header Accept = 'application/json'
And header Authorization = 'Basic' + ' ' + expected
And retry until response.response_code == '#(RC)'
When method get
Then status 200

但是我总是得到retry condition not satisfied: response.response_code == '#(RC)' 但是当我在下面更改此代码时:

And retry until response.response_code == '#(RC)'至     And retry until response.response_code == '00',可以完美运行...

所以,为什么我在使用此'#(RC)'时总是得到retry until condition not satisfied

1 个答案:

答案 0 :(得分:2)

#(foo)表示法仅适用于JSON和XML。范围内有变量时,可以按如下方式“直接”使用它:

And retry until response.response_code == RC

如果您仍然遇到问题,只需通过RC对其进行设置来确保正确设置print的值。

请参阅文档:https://github.com/intuit/karate#karate-expressions