安装cucumber遇到的几个问题

来源:互联网 发布:linux 服务器版 编辑:程序博客网 时间:2024/05/30 18:30

我的环境是这样的:

RubyGems Environment:  - RUBYGEMS VERSION: 2.0.14  - RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [x64-mingw32]  - INSTALLATION DIRECTORY: D:/ruby-2.0.0/lib/ruby/gems/2.0.0  - RUBY EXECUTABLE: D:/ruby-2.0.0/bin/ruby.exe  - EXECUTABLE DIRECTORY: D:/ruby-2.0.0/bin  - RUBYGEMS PLATFORMS:    - ruby    - x64-mingw32
*** LOCAL GEMS ***bigdecimal (1.2.0)builder (3.2.2)cucumber (1.3.18)diff-lcs (1.2.5)gherkin (2.12.2)io-console (0.4.2)json (1.8.1, 1.7.7)minitest (4.3.2)multi_json (1.10.1)multi_test (0.1.1)psych (2.0.0)rake (0.9.6)rdoc (4.0.0)rspec (3.1.0)rspec-core (3.1.7)rspec-expectations (3.1.2)rspec-mocks (3.1.3)rspec-support (3.1.2)test-unit (2.0.0.0)

问题一:

E:\practice\cucumberdemo>cucumber test.featureWARNING: cannot load such file -- 2.0/gherkin_lexer_enCouldn't load 2.0/gherkin_lexer_enThe $LOAD_PATH was:libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/cucumber-1.3.18/bin/../libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/builder-3.2.2/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/diff-lcs-1.2.5/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/multi_json-1.10.1/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/gherkin-2.12.2/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/multi_test-0.1.1/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/cucumber-1.3.18/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/json-1.8.1/libD:/ruby-2.0.0/lib/ruby/site_ruby/2.0.0D:/ruby-2.0.0/lib/ruby/site_ruby/2.0.0/x64-msvcrtD:/ruby-2.0.0/lib/ruby/site_rubyD:/ruby-2.0.0/lib/ruby/vendor_ruby/2.0.0D:/ruby-2.0.0/lib/ruby/vendor_ruby/2.0.0/x64-msvcrtD:/ruby-2.0.0/lib/ruby/vendor_rubyD:/ruby-2.0.0/lib/ruby/2.0.0D:/ruby-2.0.0/lib/ruby/2.0.0/x64-mingw32. Reverting to Ruby lexer.WARNING: cannot load such file -- 2.0/gherkin_lexer_enCouldn't load 2.0/gherkin_lexer_enThe $LOAD_PATH was:libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/cucumber-1.3.18/bin/../libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/builder-3.2.2/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/diff-lcs-1.2.5/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/multi_json-1.10.1/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/gherkin-2.12.2/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/multi_test-0.1.1/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/cucumber-1.3.18/libD:/ruby-2.0.0/lib/ruby/gems/2.0.0/gems/json-1.8.1/libD:/ruby-2.0.0/lib/ruby/site_ruby/2.0.0D:/ruby-2.0.0/lib/ruby/site_ruby/2.0.0/x64-msvcrtD:/ruby-2.0.0/lib/ruby/site_rubyD:/ruby-2.0.0/lib/ruby/vendor_ruby/2.0.0D:/ruby-2.0.0/lib/ruby/vendor_ruby/2.0.0/x64-msvcrtD:/ruby-2.0.0/lib/ruby/vendor_rubyD:/ruby-2.0.0/lib/ruby/2.0.0D:/ruby-2.0.0/lib/ruby/2.0.0/x64-mingw32. Reverting to Ruby lexer.

这种错误,查询了一下google group邮件组的issues,发现是cucumber的一个bug,在Windows 64位系统上会出现,目前消除这种问题的方式是:找到../gems/gherkin-*.*.*/lib/gherkin/c_lexer.rb文件的第七行,修改prefix = '',避免提示这种错误。


问题二:

按照正常的编写feature文件和step definition,却一直提示步骤未定义。

我之前使用的命令是到当前目录下执行cucumber test.feature,发现不行。改用cucumber cucumberdemo/test.feature -r cucumberdemo 才能执行。这个问题暂时先记着,回来找到原因我再补充。


问题三:

总是提示:cannot load such file -- spec/expectations (LoadError)

这个是因为rspec-expectations在3.0版本以上修改了运行的逻辑,需要在env.rb中把require 'spec/expectations' 修改成 require 'rspec' 才行。



0 0
原创粉丝点击