Cucumber:命令失败,状态为 (1),具有 rake 功能
我正在使用 Rails 2.3.5 黄瓜 (0.10.0) 黄瓜导轨 (0.3.2) 水豚 (0.4.1.2) rspec (2.5.0) rspec-核心 (2.5.1) rspec 期望 (2.5.0) rspec-模拟 (2.5.0) rspec-rails (2.5.0)
我有这种情况
功能:用户登录
Scenario: User sees the admin login page
Given There exists an admin login page
When I visit the admin login page
Then she should see the "login , Password" fields
And she should see links to "Forgot Password? , Do not have an account?"
和我的 Web 步骤
Given /^There exists an admin login page$/ do
Capybara.default_host = "admin.local"
Capybara.app_host = "http://admin.local:9887" if Capybara.current_driver == :selenium
end
When /^I visit the admin login page$/ do
visit ('/')
end
Then /^she should see the "([^"]*)" fields$/ do |fields|
fields.split(/,/).each do |field|
page.should have_xpath("//*[@id='user_session_#{field.downcase.strip}']")
end
end
Then /^she should see links to "([^"]*)"$/ do |links|
links.split(/,/).each do |link_name|
page.should have_content(link_name.strip)
end
end
我将管理控制台映射为子域,如 Web 步骤中所示。
我面临的问题是,当我使用 cucumber-f Pretty 运行此场景时,所有步骤都通过了,并且整体场景看起来不错。
但是,当我执行 rake features 或 rake cucumber 时:我收到以下错误(我用跟踪发布错误)
$ rake features --trace --verbose
** Invoke features (first_time)
** Invoke cucumber (first_time)
** Invoke cucumber:ok (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Execute cucumber:ok
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib:lib" "/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/bin/cucumber" --profile default
Using the default profile...
/Users/raghavendra/Projects/project/project/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
F----F
Failing Scenarios:
cucumber features/user_features/user_login_and_creation.feature:3 # Scenario: User sees the admin login page
1 scenario (1 failed)
4 steps (4 skipped)
0m0.005s
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `sh'
/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib/cucumber/rake/task.rb:72:in `run'
/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib/cucumber/rake/task.rb:142:in `define_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
任何想法或帮助将不胜感激:)
I am using rails 2.3.5 with
cucumber (0.10.0)
cucumber-rails (0.3.2)
capybara (0.4.1.2)
rspec (2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
rspec-mocks (2.5.0)
rspec-rails (2.5.0)
I have this scenario
Feature: User Login
Scenario: User sees the admin login page
Given There exists an admin login page
When I visit the admin login page
Then she should see the "login , Password" fields
And she should see links to "Forgot Password? , Do not have an account?"
And my web steps
Given /^There exists an admin login page$/ do
Capybara.default_host = "admin.local"
Capybara.app_host = "http://admin.local:9887" if Capybara.current_driver == :selenium
end
When /^I visit the admin login page$/ do
visit ('/')
end
Then /^she should see the "([^"]*)" fields$/ do |fields|
fields.split(/,/).each do |field|
page.should have_xpath("//*[@id='user_session_#{field.downcase.strip}']")
end
end
Then /^she should see links to "([^"]*)"$/ do |links|
links.split(/,/).each do |link_name|
page.should have_content(link_name.strip)
end
end
I have my admin console mapped as a sub domain as shown in the web steps.
The problem that I am facing is when i run this scenario using cucumber-f pretty
all the steps pass and the overall scenario looks good.
But when i do rake features or rake cucumber:all I get this below error ( I am posting the error with trace)
$ rake features --trace --verbose
** Invoke features (first_time)
** Invoke cucumber (first_time)
** Invoke cucumber:ok (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Execute cucumber:ok
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I "/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib:lib" "/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/bin/cucumber" --profile default
Using the default profile...
/Users/raghavendra/Projects/project/project/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
F----F
Failing Scenarios:
cucumber features/user_features/user_login_and_creation.feature:3 # Scenario: User sees the admin login page
1 scenario (1 failed)
4 steps (4 skipped)
0m0.005s
rake aborted!
Command failed with status (1): [/System/Library/Frameworks/Ruby.framework/...]
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `sh'
/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib/cucumber/rake/task.rb:72:in `run'
/Library/Ruby/Gems/1.8/gems/cucumber-0.10.0/lib/cucumber/rake/task.rb:142:in `define_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Any idea or help would be highly appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然我不确定这是否与您的问题完全相关,但 RSpec 2.x 仅适用于 Rails 3.x。您将需要 RSpec 1.3.x 与 Rails 2.3.x 一起使用。
While I am not sure this relates exactly to your issue, but RSpec 2.x is Rails 3.x only. You will want RSpec 1.3.x for use with rails 2.3.x.
当 cucumber.yml 文件中定义了 --strict 时,如果存在任何待处理或未定义的步骤,Cucumber 会抛出非零返回。尝试采取 ---strict ,看看这是否适合你。
Cucumber throws a non zero return if there are any pending or undefined steps, when --strict is defined in your cucumber.yml file. Try taking ---strict and see if that works for you.