我已經繼承了一個Rails(3)應用程序,並試圖抓住現有的黃瓜測試。我有在應用程序的「功能」文件夾下面的設置(我已經錯過了這是不相關的任何文件,如額外的功能和步驟)「耙」運行我所有的黃瓜測試罰款,但「黃瓜」沒有步驟
/features
/people
new-person.feature
/step_definitions
people_steps.rb
web_steps.rb
/support
env.rb
paths.rb
selectors.rb
如果我運行「耙」,那麼它運行feature/people/new-person.feature中的所有功能,正確使用step_definitions中列出的步驟。
但是,我不想每次運行耙子,因爲它需要很長時間,我只想在黃瓜中運行特定的測試,例如, cucumber features/people/new-person.feature -l 8
當我這樣做,它運行該功能,但尚未加載的步驟。我回來了:
Using the default profile...
Feature: Add a new person
In order to allocate tasks to people
As a community manager
I want to add a new person
Scenario: Secondary navigation should contain "Add new person" # features/people/new-person.feature:8
Given I am on the new person page # features/people/new-person.feature:9
Undefined step: "I am on the new person page" (Cucumber::Undefined)
features/people/new-person.feature:9:in `Given I am on the new person page'
Then I should not see "Add new person" # features/people/new-person.feature:10
Undefined step: "I should not see "Add new person"" (Cucumber::Undefined)
features/people/new-person.feature:10:in `Then I should not see "Add new person"'
1 scenario (1 undefined)
2 steps (2 undefined)
0m0.005s
You can implement step definitions for undefined steps with these snippets:
Given /^I am on the new person page$/ do
pending # express the regexp above with the code you wish you had
end
Then /^I should not see "([^"]*)"$/ do |arg1|
pending # express the regexp above with the code you wish you had
end
If you want snippets in a different programming language, just make sure a file
with the appropriate file extension exists where cucumber looks for step definitions.
爲什麼不是黃瓜加載的步驟?我猜想我需要在某個地方需要步驟,但我無法弄清楚在哪裏。
謝謝,最大
對於參數的緣故將特徵文件移動到一個目錄中。我在我的各種.feature文件中沒有任何地方需要,我沒有看到任何配置goop在功能/支持/文件,似乎指向這一點。你確定你的people_steps.rb代碼是功能性的嗎?你有沒有犧牲一隻雞? – jaydel 2011-06-07 12:32:16
@jaydel - 這一切工作正常,當我只用'耙子',即步驟都加載罰款。我想繼續追求我的特色,只是爲了將他們組織成合理的團體。 – 2011-06-07 14:34:40
@jaydel - 但是,將功能文件移動到主要功能文件夾確實解決了問題...必須有一個需要某處,我需要添加額外的「../」我估計。 – 2011-06-07 14:37:12