在我的cucumber.yml中,我尝试添加此选项(default: --drb --format progress
),但它返回错误:
Exception encountered: #<ArgumentError: wrong number of arguments (3 for 2)
Error creating formatter: progress>
当我在括号default: --drb --"format progress"
中使用它时,它没有帮助:
invalid option: --format progress (OptionParser::InvalidOption)
所以也许没有选择,只有it should be
“格式漂亮”无需任何括号即可正常工作。 我希望在控制台中看不到所有场景,但是哪个场景有错误,也许还有另一种方法可以做到这一点。
完整追踪:
wrong number of arguments (3 for 2)
Error creating formatter: progress (ArgumentError)
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.0/lib/active_record/base.rb:1543:in `initialize'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:168:in `new'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:168:in `block in formatters'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:163:in `map'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:163:in `formatters'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:68:in `build_tree_walker'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/runtime.rb:42:in `run!'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/main.rb:43:in `execute!'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/main.rb:20:in `execute'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/bin/cucumber:14:in `<top (required)>'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/bin/cucumber:19:in `load'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/bin/cucumber:19:in `<main>'
如果我在cucumer.yml中写选项,则错误略有不同:
Exception encountered: #<ArgumentError: wrong number of arguments (3 for 2)
Error creating formatter: progress>
backtrace:
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/activerecord-3.1.0/lib/active_record/base.rb:1543:in `initialize'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:168:in `new'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:168:in `block in formatters'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:163:in `map'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:163:in `formatters'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/configuration.rb:68:in `build_tree_walker'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/runtime.rb:42:in `run!'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/cucumber-1.1.0/lib/cucumber/cli/main.rb:43:in `execute!'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.0.rc9/lib/spork/test_framework/cucumber.rb:24:in `run_tests'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:13:in `block in run'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.0.rc9/lib/spork/forker.rb:21:in `block in initialize'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.0.rc9/lib/spork/forker.rb:18:in `fork'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.0.rc9/lib/spork/forker.rb:18:in `initialize'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:9:in `new'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:9:in `run'
/home/alder/.rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.0.rc9/lib/spork/server.rb:48:in `run'
/home/alder/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/home/alder/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/home/alder/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/home/alder/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/home/alder/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'
顺便说一下,我有一个Spork可能是个问题。
答案 0 :(得分:4)
根据您问题中的更新信息,我认为我看到了问题(因此我发布了另一个答案,因为它与我的另一个完全不同)。看起来Cucumber正在尝试实例化一个ActiveRecord类,所以我怀疑你的项目中有一个名为'Progress'的模型,Cucumber正试图创建而不是实际的格式化程序。
通过在“support”文件夹中添加此类,我能够重现您的问题(无论如何足够接近):
class Progress
def initialize
raise "I don't exist!"
end
end
根据文档,你应该能够在这里指定一个完全限定的类名,即--format Cucumber::Formatter::Progress
,以迫使Cucumber使用它自己的格式化程序。但是,我尝试了这个并且它仍然无效,黄瓜如何解析完全限定名称似乎存在错误。
通过将此行添加到我的env.rb
文件中,我能够解决这个问题:
require 'cucumber/formatter/progress'
然后让我成功运行cucumber --format progress
。
我认为,当env.rb
在任何其他代码之前执行时,Cucumber的Progress
类将是创建格式化程序时找到的第一个类。
答案 1 :(得分:0)
从您粘贴的输出中看,您在cucumber.yml
文件中有一个额外的角度('&gt;')括号:
创建格式化程序时出错:进度&gt;
除非你的问题出现问题,否则由于某些原因,Cucumber正在尝试创建一个名为'progress&gt;'的格式化程序,所以你可能只需要找到并删除额外的尖括号。
编辑:这根本不是问题,请参阅my other answer