运行黄瓜测试时出现一个奇怪的错误。所有测试都运行良好,但最后出现此错误:
→ bundle exec rake cucumber
/Users/rudolf/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -S bundle exec cucumber --profile default
Using the default profile...
(All tests run properly at this point)
27 scenarios (27 passed)
245 steps (245 passed)
0m27.778s
/Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1037:in `block in process_args': invalid option: --profile (OptionParser::InvalidOption)
from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1016:in `new'
from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1016:in `process_args'
from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1066:in `_run'
from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:1059:in `run'
from /Users/rudolf/.rvm/gems/ruby-2.0.0-p247@global/gems/minitest-4.7.5/lib/minitest/unit.rb:795:in `block in autorun'
我正在使用带有 Rails 4 的 Ruby 2,这是我的 Gemfile 中的测试部分:
group :development, :test do
gem 'rspec-rails'
gem 'capybara'
gem 'cucumber-rails', require: false
gem 'selenium-webdriver'
gem 'database_cleaner'
gem 'shoulda-matchers'
gem 'nokogiri'
end
我也在 Semaphore ( https://semaphoreapp.com ) 上运行这些测试,它也发生在那里。
编辑cucumber.yml
::
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip