rubyMine“无法将测试报告器附加到测试框架”

发布于 2024-12-06 10:31:18 字数 1112 浏览 8 评论 0原文

rubyMine 运行所有模型测试时出现“检测到 MiniTest 框架”错误。

我可以在常规命令行运行所有模型测试。 例如rake spec:models
当我使用 ruby​​Mine 时:
我可以正常运行一个模型测试。
但是,当我尝试运行模型中的所有测试时,我得到
已检测到 MiniTest 框架。它是原始 Test::Unit 框架的有限版本。 RubyMine/IDEA Ruby 插件测试运行器需要框架的全功能版本, 否则将使用默认的控制台测试报告器。 请安装“test-unit”gem 并在运行时激活它。

我尝试将“test-unit”添加到我的 Gemfile 中并重新捆绑,但现在

`/home/durrantm/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) 
  /home/durrantm/Downloads/RubyMine-3.2.3/rb/testing/runner/tunit_in_folder_runner.rb
Testing started at 9:33 AM ...
Work directory: /home/durrantm/Dropbox_not_syncd/webs/3/rubyists/spec/models}
Loading files.... 
=========================================
0 files were loaded.
=========================================
Searching test suites...
=========================================
0 test suites, 0 tests, 0 assertions, 0 failures, 0 errors
Process finished with exit code 0`

在工作目录中得到: 注意:funny }。我仍然收到 Unable to Attach test_reporter to test fraemwork 消息

版本: 乌班图11 红宝石矿3.2

rubyMine 'MiniTest framework was detected' error when running all model tests.

I can run all model tests at the regular command line.
e.g. rake spec:models
When I use rubyMine:
I can run one model test ok.
However when I try to run all tests in model I get
MiniTest framework was detected. It is a limited version of original Test::Unit framework.
RubyMine/IDEA Ruby plugin test runner requires full-featured version of the framework,
otherwise default console tests reporter will be used instead.
Please install 'test-unit' gem and activate it on runtime.

I tried adding the 'test-unit' to my Gemfile and rebundling but now get:

`/home/durrantm/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) 
  /home/durrantm/Downloads/RubyMine-3.2.3/rb/testing/runner/tunit_in_folder_runner.rb
Testing started at 9:33 AM ...
Work directory: /home/durrantm/Dropbox_not_syncd/webs/3/rubyists/spec/models}
Loading files.... 
=========================================
0 files were loaded.
=========================================
Searching test suites...
=========================================
0 test suites, 0 tests, 0 assertions, 0 failures, 0 errors
Process finished with exit code 0`

Note: funny } in work directory. I still get the Unable to attach test_reporter to test fraemwork message.

Versions:
Ubuntu 11
RubyMine 3.2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦幻的心爱 2024-12-13 10:31:18

我终于让这个工作了。
主要是通过更改菜单下的内容:
运行->编辑配置->点击Rspec ->创建一个新配置。

对于新配置,请确保规格文件夹指向应用程序规格模型。

最后一步(实际上让它工作的一步)是将工作目录(仍在运行/调试配置屏幕上)设置为我的应用程序根目录!

我还做的另一件事是将 gem 'test-unit' 添加到 Gemfile 中,当然也将其捆绑在一起。然而后来的测试(删除它并解绑)表明不需要它,实际上是使用空套件多次运行测试(也许尝试默认的unit::test以及运行rspec)。

I finally got this to work.
Mostly by changing stuff under Menus:
Run -> Edit configurations -> Click on Rspec -> Create a new Configuration.

For the new configuration made sure specs folder points to the application specs models.

Final step (the one that actually that got it working) was to set the working directory (still on the run/debug configuration screen that is) to be my applications root!

The other thing I had also done was to add gem 'test-unit' to the Gemfile and bundled it of course. However later testing (removing it and unbundling) showed it not to be needed and in fact was making tests run multiple times with empty suites (maybe trying default unit::test as well as running rspec).

ぶ宁プ宁ぶ 2024-12-13 10:31:18

我也遇到了这个问题,但解决方法与其他海报不同。

在 ruby​​mine 中,我添加了 minitest-reporters gem。然后在我的 minitest_helper.rb 中添加了以下内容:

require "minitest/reporters"
MiniTest::Unit.runner = MiniTest::SuiteRunner.new
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMineReporter.new

I also had this problem but solved it differently than the other posters.

In rubymine I added the minitest-reporters gem. Then in my minitest_helper.rb I added the following:

require "minitest/reporters"
MiniTest::Unit.runner = MiniTest::SuiteRunner.new
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMineReporter.new
拥抱没勇气 2024-12-13 10:31:18

在我的系统上,问题出在“红绿”宝石上。它根据成功或失败自动为进度标记(点)和 Test::Unit 摘要消息着色。 RubyMine 中一定有某些东西正在尝试解析 Test::Unit 结果(我想是“rake test”的输出),并且它被 ANSI 序列阻塞了。

我在 test/test_helper.rb 中注释掉了“require 'redgreen'”,问题就消失了。不过,我真的很喜欢 redgreen 从 shell 执行“rake 测试”,所以我把它放在 test_helper 中,使其适用于“rake 测试”和 RubyMine:

require 'redgreen' if $stdin.tty?< /code>

导致您问题的可能不是 redgreen,但要怀疑任何可能创建非常规 Test::Unit 输出的内容。

祝你好运!

On my system, the problem was the "redgreen" gem. It automatically colors the progress marks (dots) and the Test::Unit summary messages based on success or failure. There must be something in RubyMine that's trying to parse the Test::Unit results (the output of "rake test", I imagine), and it's choking on the ANSI sequences.

I commented out "require 'redgreen'" in my test/test_helper.rb, and the problem went away. I really like redgreen for executing "rake test" from the shell, though, so I put this in test_helper to make it work for both "rake test" and within RubyMine:

require 'redgreen' if $stdin.tty?

It may not be redgreen that's causing your problem, but be suspicious of anything which might create unconventional Test::Unit output.

Good luck!

辞慾 2024-12-13 10:31:18

对我来说,我通过确保文件命名正确来解决了这个问题。需要以单词 test 开头或以单词 test 结尾。这实际上取决于您在测试配置下的“测试文件名掩码”。对我来说,我的是:*/{_test,test_*}.rb

例如:test_case_01.rbcase_01_test.rb

For me, I resolved this issue by making sure files are named correctly. Needed to start with the word test or end with the word test. This really depends your "Test File name mask" under test configurations. For me, mine was: */{_test,test_*}.rb

Ex: test_case_01.rb or case_01_test.rb

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文