2012-06-19 22 views
1

嗨這裏的幾個值的黃瓜例子就是我我有什麼:我能在單個列X行位置

Scenario Outline: Seatching for stuff 
Given that the following simple things exists: 
    | id | title     | description       | temp  | 
    | 1 | First title   | First description      | low  | 
    | 2 | Second title   | Second description with öl   | Medium | 
    | 3 | Third title   | Third description      | High  | 
    | 11 | A title with number 2 | can searching numbers find this 2  | Exreme | 
When I search for <criteria> 
Then I should get <result> 
And I should not get <excluded> 

Examples 
|criteria|results | excluded | 
| 1  | 1  | 2,3,11 | 
| 11  | 11  | 1,2,3  | 
| title | 1,2,3 | 11  | 
| öl  | 2  | 1,3,11 | 
| Fir* | 1  | 2,3,11 | 
| third | 3  | 1,2,11 | 
| High | 3  | 1,2,11 | 

正如你可以看到我想要測試搜索領域的使用黃瓜的web應用程序和場景大綱結構以測試多個搜索條件。 我不知道如何處理輸入的結果,並在我的步驟中排除。

也許這根本行不通? 有沒有解決方法?

+0

有什麼不妥。你有錯誤嗎?你有沒有試過運行它?你真的想從我們這裏知道什麼? – MrDanA

+0

沒有錯誤我只是無法找到任何使用示例中的一個單元格中的表單值,值,值的示例。所以我不知道如何在我的步驟中處理它然後/ ^我應該得到(。*)$/do | result |。我如何從結果中獲得單獨的值。 –

回答

2

你在做什麼沒有問題。黃瓜只會把它當作一根線。事實上,它實際上是以逗號分隔的值對黃瓜沒有任何意義。

你的步驟定義仍然會是這樣的:

Then /^I should not get ([^"]*)$/ do |excluded| 
    # excluded will be a string, "2,3,11" 
    values = excluded.split(",") 

    # Do whatever you want with the values 
end 
+0

Ofcourse ...我很笨tyvm –

+0

哈這是好的。別客氣。 – MrDanA

相關問題