1

我正在使用 JRUBY/Cucumber/Watir 框架,并且我有一个特定的功能文件夹,每次尝试使用内置的 HTML 格式化程序时都会抛出此错误:

    uninitialized constant Syntax::Ruby::Set
    Error creating formatter: html (NameError)
    org/jruby/RubyModule.java:2690:in `const_missing'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax         /lang/ruby.rb:11:in `Ruby'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax  /lang/ruby.rb:8:in `Syntax'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax/lang/ruby.rb:3:in `(root)'
    org/jruby/RubyKernel.java:1083:in `require'
    /Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
    /Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53:in `require'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax.rb:1:in `(root)'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax.rb:24:in `load'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/syntax-1.2.0/lib/syntax/convertors/abstract.rb:16:in `for_syntax'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:580:in `SnippetExtractor'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:578:in `Html'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:8:in `Formatter'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:7:in `Cucumber'
org/jruby/RubyKernel.java:1083:in `require'
    /Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
    /Users/Casey.Guerrero/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53:in `require'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/formatter/html.rb:6:in `(root)'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/constantize.rb:1:in `(root)'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/constantize.rb:17:in `constantize'
    org/jruby/RubyArray.java:2409:in `map'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:81:in `formatter_class'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:182:in `formatters'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:178:in `formatters'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/configuration.rb:76:in `build_tree_walker'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/runtime.rb:46:in `run!'
    org/jruby/RubyKernel.java:1099:in `load'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/gems/cucumber-1.3.14/bin/../lib/cucumber/cli/main.rb:47:in `execute!'
    org/jruby/RubyKernel.java:1119:in `eval'
    /Users/Casey.Guerrero/.rvm/gems/jruby-1.7.10/bin/jruby_executable_hooks:15:in `(root)'

使用cucumber-1.3.14and jruby-1.7.10,虽然错误发生在jruby-1.7.4. 支持目录中没有包含格式化程序,也没有在env.rb.不使用 rake 或任何运行单个功能的任何地方引用任何格式化程序。奇怪的是,其他功能文件夹可以输出与失败的具有相同命令参数的 html 报告。例子:

cucumber features/AddText.feature -f html -o report.html -f pretty 

或者

cucumber features/AddText.feature --format html --out report.html --format pretty

任何见解都会有所帮助。

更新:

出于某种原因,卸载“语法”gem 允许运行功能并生成 html 报告。我的印象是'语法'是'黄瓜'依赖......

4

3 回答 3

3

当 Cucumber 中发生测试失败时,将以下行写入控制台:

# gem install syntax to get syntax highlighting

不幸的是,这会导致人们安装语法 gem,这是导致错误的原因。

执行 ' gem uninstall syntax' 或 ' sudo gem uninstall syntax' 以避免此错误。

于 2014-05-22T15:06:20.837 回答
0

Run "gem uninstall syntax" this will work

于 2014-06-02T08:32:38.913 回答
0

我知道这是有点旧的线程,但想清除一些东西。

黄瓜 1.3.17 和 1.3.18 取决于语法 >= 1.0.0

在当前情况下,问题在于语法 1.2.0 而不是所有版本的语法。

所以我们应该做的是

卸载语法 1.2.0 并安装语法 1.0.0

sudo gem install syntax -v 1.0.0
于 2015-01-22T06:58:57.980 回答