简体   繁体   English

测试从命令行运行,但不在RubyMine中运行 - 未找到测试

[英]Tests run from command line but not in RubyMine - No tests were found

I am trying to use RubyMine to run the tests in an existing project. 我正在尝试使用RubyMine在现有项目中运行测试。 Unfortunately, whenever I attempt to do so I receive the message that No tests were found and the bottom of test console output I see the message: 不幸的是,每当我尝试这样做时,我收到的消息是没有找到测试 ,测试控制台输出的底部我看到了消息:

Errors running test:units and test:functionals!
Empty test suite.

Process finished with exit code 1

I have tried running the tests with and without the command 我尝试使用和不使用命令运行测试
-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) but haven't tweaked the default test configuration beyond that. -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)但尚未调整默认测试配置。 Below is the current configuration as a reference: 以下是当前配置作为参考:

RubyMine运行/调试配置

Full dump of test console from within RubyMine: 从RubyMine中完全转储测试控制台:

C:\Ruby187\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\Ruby187\bin/rake test
Testing started at 1:41 PM ...
(in C:/CodeMetrics/2nd/cmusv)
C:/Ruby187/bin/ruby.exe -I"lib;test" "C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/course_number_test.rb" "test/unit/course_test.rb" "test/unit/curriculum_comment_test.rb" "test/unit/curriculum_comment_type_test.rb" "test/unit/effort_log_line_item_test.rb" "test/unit/effort_log_mailer_test.rb" "test/unit/effort_log_template_test.rb" "test/unit/effort_log_test.rb" "test/unit/google_apps_test.rb" "test/unit/page_test.rb" "test/unit/paper_test.rb" "test/unit/person_test.rb" "test/unit/project_test.rb" "test/unit/project_type_test.rb" "test/unit/rss_feed_test.rb" "test/unit/scotty_dog_saying_test.rb" "test/unit/task_type_test.rb" "test/unit/team_test.rb" "test/unit/time_machine_test.rb" "test/unit/user_test.rb" 
C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Test::Unit::UI::SILENT (NameError)
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in `rake_original_const_missing'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/test-unit-1.2.3/lib/test/unit/autorunner.rb:47
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:\Program Files (x86)\JetBrains\RubyMine 97.39/rb/testing\patch\testunit/test/unit/autorunner.rb:24
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/test-unit-2.1.1/lib/test/unit.rb:2
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/shoulda-2.11.3/lib/shoulda/integrations/test_unit.rb:1
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/shoulda-2.11.3/lib/shoulda.rb:8
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in `each'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in `require'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in `each'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in `require'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler.rb:112:in `require'
    from C:/CodeMetrics/2nd/cmusv/config/boot.rb:43:in `load_gems'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:164:in `process'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
    from C:/CodeMetrics/2nd/cmusv/config/environment.rb:17
    from ./test/test_helper.rb:2:in `require'
    from ./test/test_helper.rb:2
    from ./test/unit/course_number_test.rb:1:in `require'
    from ./test/unit/course_number_test.rb:1
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
C:/Ruby187/bin/ruby.exe -I"lib;test" "C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/functional/courses_controller_test.rb" "test/functional/course_numbers_controller_test.rb" "test/functional/curriculum_comments_controller_test.rb" "test/functional/curriculum_comment_types_controller_test.rb" "test/functional/effort_logs_controller_test.rb" "test/functional/effort_log_line_items_controller_test.rb" "test/functional/effort_reports_controller_test.rb" "test/functional/mailing_lists_controller_test.rb" "test/functional/pages_controller_test.rb" "test/functional/papers_controller_test.rb" "test/functional/people_controller_test.rb" "test/functional/projects_controller_test.rb" "test/functional/project_types_controller_test.rb" "test/functional/rss_feeds_controller_test.rb" "test/functional/scotty_dog_sayings_controller_test.rb" "test/functional/sessions_controller_test.rb" "test/functional/system_controller_test.rb" "test/functional/task_types_controller_test.rb" "test/functional/teams_controller_test.rb" "test/functional/users_controller_test.rb" "test/functional/welcome_controller_test.rb" 
C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Test::Unit::UI::SILENT (NameError)
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in `rake_original_const_missing'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/test-unit-1.2.3/lib/test/unit/autorunner.rb:47
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:\Program Files (x86)\JetBrains\RubyMine 97.39/rb/testing\patch\testunit/test/unit/autorunner.rb:24
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/test-unit-2.1.1/lib/test/unit.rb:2
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/shoulda-2.11.3/lib/shoulda/integrations/test_unit.rb:1
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/shoulda-2.11.3/lib/shoulda.rb:8
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64:in `require'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in `each'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:62:in `require'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in `each'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:51:in `require'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler.rb:112:in `require'
    from C:/CodeMetrics/2nd/cmusv/config/boot.rb:43:in `load_gems'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:164:in `process'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
    from C:/CodeMetrics/2nd/cmusv/config/environment.rb:17
    from ./test/test_helper.rb:2:in `require'
    from ./test/test_helper.rb:2
    from ./test/functional/courses_controller_test.rb:1:in `require'
    from ./test/functional/courses_controller_test.rb:1
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
    from C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
C:/Ruby187/bin/ruby.exe -I"lib;test" "C:/CodeMetrics/2nd/cmusv/autotest-growl/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"  
Errors running test:units and test:functionals!
Empty test suite.

Process finished with exit code 1

What's the difference between running from the command line and from within RubyMine? 从命令行运行和从RubyMine中运行有什么区别?

It looks like this may have something to do with the environment rubymine sets up (C:/CodeMetrics/2nd/cmusv/) and the latest test-unit gem's incompatibility with Rails 2.x. 看起来这可能与环境rubymine设置(C:/ CodeMetrics / 2nd / cmusv /)和最新的测试单元gem与Rails 2.x不兼容有关。 If you didn't specify a version of the gem to install, that's likely the culprit ( See discussion here ). 如果您没有指定要安装的gem版本,那可能是罪魁祸首( 请参阅此处的讨论 )。

Try reverting the test-unit gem back to 1.2.3 in your project's configuration. 尝试将测试单元gem恢复为项目配置中的1.2.3。

What worked for me was REMOVING the Environment variable "RAILS_ENV=test" . 对我有用的是REMOVING环境变量"RAILS_ENV=test" After that everything was great! 之后一切都很棒!

RubyMine v-3.2.4 & v-4.0Beta RM-112.49 RubyMine v-3.2.4&v-4.0Beta RM-112.49

Ruby 1.9.3 and Ruby 1.9.2 Ruby 1.9.3和Ruby 1.9.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM