RubyMineunit testing – 测试框架意外退出
当我尝试从RubyMine中运行测试时,我遇到了问题。 但奇怪的是,当我从命令行运行测试时,它工作正常。
“测试框架意外退出”
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -Itest /Users/sabour/Desktop/EIP/project/test/controllers/categories_controller_test.rb Testing started at 1:39 AM ... Run options: --seed 14336 # Running tests: /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228: warning: nested repeat operator + and ? was replaced with '*' ... Finished tests in 2.554592s, 1.1744 tests/s, 8.6119 assertions/s. 3 tests, 22 assertions, 0 failures, 0 errors, 0 skips Process finished with exit code 0
也许问题来自那条线?
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:警告:嵌套重复运算符+和? 被’*’取代……
模式:测试脚本使用预加载服务器:无Ruby参数: -e $ stdout.sync = true; $ stderr.sync = true; load($ 0 = ARGV.shift)-Itest Ruby SDK: project
但我希望有这样的事情:
谢谢
有一个很好的教程可以在他们的在线帮助中设置RubyMine测试,这有助于我解决你描述的相同问题(对于Test::Unit
style测试)。 基本上你需要将minitest
和minitest-reporters
gems包含到你的项目中并添加一个调用来使用新的测试报告格式:
# Gemfile group :test do gem 'minitest' gem 'minitest-reporters' end # test/test_helper.rb require 'minitest/reporters' MiniTest::Reporters.use!
查看教程以获取更多选项。
我遇到了同样的问题,这是因为没有安装(全局?)测试库的ruby gems。 例如,对于minitest测试框架(您没有指定您使用的是哪一个),只需从命令行运行:
gem install minitest gem install minitest-reporters
这解决了我的问题。
从RubyMine运行时遇到了同样的问题(但不是从命令行运行)。 它通过重新启动弹簧来修复:
bin/spring stop bin/spring status
您可以修复它,指定RSpec的PATH。 为了在Ubuntu中找到正确的路径,我使用了该命令
哪里是rpsec
在RubyMine中,转到菜单“运行”>“编辑配置”,选中“使用自定义RSpec转轮脚本”,然后设置之前找到的路径。
我有同样的问题,我通过从Gemfile中删除’guard-minitest’来解决这个问题
您应该确保您的测试套件正在使用RAILS_ENV=test
运行
对于RubyMine,您可以在Run > Edit Configurations.. > Choose test suite you want to run (ie spec: project_name) > Environment variables
然后添加上面提到的变量。
如果未检出某些gem,您可能会收到此错误,因此您需要运行bundle install
。 从终端运行测试,如果是这种情况,您将收到错误