2017-10-09 48 views
1

在我的特點,我有:如何在場景大綱示例中加入一個值(空手道框架)?

* 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. 

而不是接收'foo.com/13'但(假定該ID是13)我有'foo.com/id'。我嘗試了#,但它不起作用。我怎樣才能取代這個ID?我需要測試此字符串格式的ID。謝謝

回答

1

這是一個已知的黃瓜限制,即Examples不能動態。請參閱本文檔的最後一段:https://github.com/intuit/karate#the-karate-way

如果您真的想循環使用具有不同值的功能,請再次參閱上面的文檔,並且如果環顧四周,會有很多示例。看看所有以call-這裏開頭的:https://github.com/intuit/karate/tree/master/karate-demo

+0

感謝您的快速回復。這個問題不在動態示例中。我沒有解釋清楚。我事先知道我會有多少例子。我只需要把字符串形式的ID。而不是像這裏寫下13這樣的例子: | bar | |(13)| |「13」| | '13'| | 13 |我需要把id放在「」和「'這裏例如: | bar | |(id)| |「id」| |'id'| | id |但不是url/13我有url/id – nirind

相關問題