我們正試圖將CSV到黃瓜獲得的CSV文件的好處,但網上調查,當我看到這個功能,但只有「Import scenario outline 'examples' from CSV?」沒有正式的文件。導入CSV如黃瓜測試數據?
我不知道這是否涉及到任何的結論呢。它目前是否在Cucumber中使用CSV的內置方式?
如果當前沒有內置的方式來導入CSV,並且我必須編寫自己的解析方法,我想我的問題是,在步驟定義中,如何將變量與定義場景?例如:
Scenario: do something
Given I eat number as <number> cucumbers
and the cucumber is produced at date as <date>
When the cucumber is expired
Then I should have diarrhea
data.csv
number,date
1,2012-01-01
1,2012-11-03
在steps.rb,如果我這樣做:
CSV.foreach("path/to/data.csv") do |row|
...
如何我row.number
`row.date`映射到數\日期在功能文件?