Yudistira Sugandi
Yudistira Sugandi

Reputation: 187

retry until condition not satisfied on karatedsl

I have two files, first for a.feature contains

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"|

and other file b.feature contains :

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

but I always get retry condition not satisfied: response.response_code == '#(RC)' but when I change this code below :

And retry until response.response_code == '#(RC)' to And retry until response.response_code == '00' , it works perfectly...

so, why I always get retry until condition not satisfied when I use this '#(RC)' ??

Upvotes: 1

Views: 743

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58128

The #(foo) notation is meant only for JSON and XML. When you have a variable in scope, you can use it "directly" as follows:

And retry until response.response_code == RC

If you still face problems, just ensure that the value of RC is set correctly by print-ing it.

Refer the documentation please: https://github.com/intuit/karate#karate-expressions

Upvotes: 2

Related Questions