Reputation: 547
In my feature I have:
* def loc = responseHeaders['location'][10]
* def id = loc.substring(loc.lastIndexOf('/') + 1)
And I would like to use id in scenario outline examples:
Scenario Outline: fkdfslqknfd
Given url 'foo.com'
And path <bar>
When method get
......
Examples:
|bar |
|(id)|
|"id"|
|'id'|
|id |> The last example is ok.
But instead of receiving 'foo.com/13'
(assuming that id is 13) I have 'foo.com/id'
. I tried with #, but it doesn't work. How I can replace this id? I need to test this id put in String format. Thanks
Upvotes: 1
Views: 9720
Reputation: 49
At least within JSON parameter, it was working for me
Examples:
| request_body |
| {username: '#(email)', password: '#(password)'} |
Upvotes: 2
Reputation: 58153
This is a known limitation of Cucumber, that the Examples
cannot be dynamic. Refer to this last paragraph of the documentation: https://github.com/intuit/karate#the-karate-way
If you are really trying to loop over a feature with different values, again, refer to the above doc, and there are plenty of examples if you look around. Look at all the ones that start with call-
here: https://github.com/intuit/karate/tree/master/karate-demo
Upvotes: 1