2010-04-18 82 views
0

其軌道2.3.5應用程序。我使用rspec和黃瓜進行測試。 當我運行autospec,它具有如下的警告(Not running features. To run features in autotest, set AUTOFEATURE=true.)正常運行:爲什麼黃瓜功能即使失敗也能繼續運行?

[~/rails_apps/automation (campaign)⚡] ➔ autospec 
(Not running features. To run features in autotest, set AUTOFEATURE=true.) 
(Not running features. To run features in autotest, set AUTOFEATURE=true.) 
loading autotest/rails_rspec 
/home/millisami/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/pathname.rb:263: warning: `*' interpreted as argument prefix 
/home/millisami/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby /home/millisami/.rvm/gems/ree-1.8.7-2010.01/gems/rspec-1.3.0/bin/spec --autospec /home/millisami/rails_apps/automation/spec/controllers/campaigns_controller_spec.rb /home/millisami/rails_apps/automation/spec/models/board_spec.rb /home/millisami/rails_apps/automation/spec/models/user_spec.rb /home/millisami/rails_apps/automation/spec/models/campaign_spec.rb /home/millisami/rails_apps/automation/spec/controllers/outlets_controller_spec.rb /home/millisami/rails_apps/automation/spec/controllers/boards_controller_spec.rb /home/millisami/rails_apps/automation/spec/models/outlet_type_spec.rb /home/millisami/rails_apps/automation/spec/models/vendor_spec.rb /home/millisami/rails_apps/automation/spec/controllers/brands_controller_spec.rb /home/millisami/rails_apps/automation/spec/controllers/vendors_controller_spec.rb /home/millisami/rails_apps/automation/spec/controllers/dashboard_controller_spec.rb /home/millisami/rails_apps/automation/spec/models/brand_spec.rb /home/millisami/rails_apps/automation/spec/helpers/dashboard_helper_spec.rb /home/millisami/rails_apps/automation/spec/models/outlet_spec.rb /home/millisami/rails_apps/automation/spec/models/client_spec.rb /home/millisami/rails_apps/automation/spec/controllers/clients_controller_spec.rb -O spec/spec.opts 

現在,因爲它表明,當我運行AUTOFEATURE=true autospec,規格運行和黃瓜功能以及。 但問題是它不會停止。它運行這些功能並在一個循環中一次又一次地運行它們。 失敗後不會停止。這是由於如下所示的警告Warning: $KCODE is NONE

[~/rails_apps/automation (campaign)⚡] ➔ AUTOFEATURE=true autospec 
loading autotest/cucumber_rails_rspec 
Warning: $KCODE is NONE. 
/home/millisami/.rvm/gems/ree-1.8.7-2010.01/gems/treetop-1.4.5/lib/treetop/ruby_extensions/string.rb:31: warning: method redefined; discarding old indent 
/home/millisami/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/pathname.rb:263: warning: `*' interpreted as argument prefix 
/home/millisami/.rvm/gems/ree-1.8.7-2010.01/gems/activesupport-2.3.5/lib/active_support/core_ext/object/blank.rb:49: warning: method redefined; discarding old blank? 
/home/millisami/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby /home/millisami/.rvm/gems/ree-1.8.7-2010.01/gems/rspec-1.3.0/bin/spec --autospec /home/millisami/rails_apps/automation/spec/controllers/campaigns_controller_spec.rb /home/millisami/rails_apps/automation/spec/models/board_spec.rb /home/millisami/rails_apps/automation/spec/models/user_spec.rb /home/millisami/rails_apps/automation/spec/models/campaign_spec.rb /home/millisami/rails_apps/automation/spec/controllers/outlets_controller_spec.rb /home/millisami/rails_apps/automation/spec/controllers/boards_controller_spec.rb /home/millisami/rails_apps/automation/spec/models/outlet_type_spec.rb /home/millisami/rails_apps/automation/spec/models/vendor_spec.rb /home/millisami/rails_apps/automation/spec/controllers/brands_controller_spec.rb /home/millisami/rails_apps/automation/spec/controllers/vendors_controller_spec.rb /home/millisami/rails_apps/automation/spec/controllers/dashboard_controller_spec.rb /home/millisami/rails_apps/automation/spec/models/brand_spec.rb /home/millisami/rails_apps/automation/spec/helpers/dashboard_helper_spec.rb /home/millisami/rails_apps/automation/spec/models/outlet_spec.rb /home/millisami/rails_apps/automation/spec/models/client_spec.rb /home/millisami/rails_apps/automation/spec/controllers/clients_controller_spec.rb -O spec/spec.opts 

回答

2

自動測試在每次運行後檢查您的rails項目中的所有文件,並在找到任何修改後重新運行測試。您需要將配置文件的例外添加到配置文件以忽略正在更改的文件。下面是一個例子.autotest

Autotest.add_hook :initialize do |at| 
    %w{.git vendor rerun.txt}.each {|exception| at.add_exception(exception)} 
end 

黃瓜其測試周期中創建rerun.txt - 這大概是什麼導致您的問題。您可能需要添加額外的條目,具體取決於您的特定系統配置。

PS。 Autospecautotest的包裝,因此如果您遇到autospec問題,在"autotest"上搜索可能會獲得更好的結果。 More about autospec/autotest and Cucumber

+0

@zetetic,謝謝你的回覆。我會回頭看看。 – Autodidact 2010-04-18 07:38:44

+0

我試過了,它以某種方式工作。 但警告是什麼意思? 警告:$ KCODE是NONE。 – Autodidact 2010-04-19 07:10:37

+0

我不得不把一些額外的文件夾,使其工作。 Autotest.add_hook:初始化do | at | %w {.git vendor rerun.txt tmp log} .each {| exception | at.add_exception(例外)} 結束 – Autodidact 2010-04-19 07:54:30

相關問題