Karate 如何在场景大纲示例(空手道框架)中添加值?

Karate 如何在场景大纲示例(空手道框架)中添加值?,karate,Karate,在我的专题中,我有: * def loc = responseHeaders['location'][10] * def id = loc.substring(loc.lastIndexOf('/') + 1) 我想在场景大纲示例中使用id: Scenario Outline: fkdfslqknfd Given url 'foo.com' And path <bar> When method get ...... Examp

在我的专题中,我有:

* def loc = responseHeaders['location'][10]
* def id = loc.substring(loc.lastIndexOf('/') + 1)
我想在场景大纲示例中使用id:

Scenario Outline: fkdfslqknfd
    Given url 'foo.com'
    And path <bar>
    When method get
    ......    
        Examples:
          |bar |
          |(id)|
          |"id"|
          |'id'|
          |id  |> The last example is ok.
场景大纲:fkdfslqknfd
给定url“foo.com”
和路径
当方法得到
......    
示例:
|酒吧|
|(id)|
|“id”|
|“身份证”|
|id |>最后一个示例是确定的。

但是我没有收到
'foo.com/13'
(假设id是13),而是收到
'foo.com/id'
。我试过用#,但没用。如何替换此id?我需要用字符串格式测试这个id。感谢

这是Cucumber的一个已知限制,
示例
不能是动态的。参考文件的最后一段:


如果你真的想用不同的值来循环一个特性,请再次参考上面的文档,如果你环顾四周,这里有很多例子。看看以
call-
开头的所有示例:

这是Cucumber的一个已知限制,即
示例不能是动态的。参考文件的最后一段:


如果你真的想用不同的值来循环一个特性,请再次参考上面的文档,如果你环顾四周,这里有很多例子。看看所有以
call-
开头的代码:

至少在JSON参数中,它对我有用

 Examples:
| request_body |
| {username: '#(email)', password: '#(password)'} |

至少在JSON参数中,它对我有效

 Examples:
| request_body |
| {username: '#(email)', password: '#(password)'} |

谢谢你的快速回复。问题不在动态示例中。我解释得不好。我提前知道我会有多少个例子。我只需要把id放在字符串中。我不需要在这里写13个例子:| bar | | |(13)| |“13”| |“13”| | | 13 | | 13 |我需要把id放在“”和“”中,比如:| bar | | |(id)|“id”|“id”| id |但是我没有url/13,谢谢你的快速回复。问题不在动态示例中。我解释得不好。我提前知道我会有多少个例子。我只需要把id放在字符串中。而不是写13个这样的例子:| bar | |(13)| |“13”| |“13”| | | 13 | | 13 |我需要把id放在“”和“”中,比如:| bar | | |(id)|“id”|“id”| id |但我没有url/13,而是url/id