问题
I've had problems with autotest before which I resolved by downgrading from ZenTest 4.1.4 to 4.1.3.
$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
$ rails -v
Rails 2.3.4
Currently I'm finding that on my Mac OS 10.6.1 Snow Leopard system, when I run $ autotest
in my project no tests are run and I get this output...
$ autotest
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I.:lib:test -rubygems -e "%w[test/unit test/test_helper.rb].each { |f| require f }" | unit_diff -u
Loaded suite -e
Started
Finished in 0.000225 seconds.
0 tests, 0 assertions, 0 failures, 0 errors
Try control-C
...
^CInterrupt a second time to quit
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I.:lib:test -rubygems -e "%w[test/unit test/test_helper.rb].each { |f| require f }" | unit_diff -u
Loaded suite -e
Started
Finished in 0.000205 seconds.
0 tests, 0 assertions, 0 failures, 0 errors
If I run $ rake test
it works fine. Runs all tests...
$ rake test
(in /Users/abc/project/abc/contactdb)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/unit/address_list_membership_test.rb" "test/unit/address_test.rb" "test/unit/application_log_message_test.rb" "test/unit/asset_test.rb" "test/unit/asset_type_test.rb" "test/unit/attribute_value_test.rb" "test/unit/contact_test.rb" "test/unit/financial_document_test.rb" "test/unit/helpers/application_helper_test.rb" "test/unit/list_test.rb" "test/unit/log_entry_test.rb" "test/unit/organization_test.rb" "test/unit/phone_number_test.rb" "test/unit/role_test.rb" "test/unit/user_test.rb"
Loaded suite /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
...........................................
Finished in 0.334388 seconds.
43 tests, 50 assertions, 0 failures, 0 errors
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/functional/addresses_controller_test.rb" "test/functional/application_controller_test.rb" "test/functional/application_log_messages_controller_test.rb" "test/functional/contacts_controller_test.rb" "test/functional/financial_documents_controller_test.rb" "test/functional/lists_controller_test.rb" "test/functional/log_entries_controller_test.rb" "test/functional/organizations_controller_test.rb" "test/functional/phone_numbers_controller_test.rb" "test/functional/sessions_controller_test.rb" "test/functional/users_controller_test.rb"
Loaded suite /Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.................................................................................................................................................................................................
Finished in 5.636152 seconds.
193 tests, 206 assertions, 0 failures, 0 errors
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
Loaded suite /usr/bin/rake
Started
Finished in 0.000253 seconds.
0 tests, 0 assertions, 0 failures, 0 errors
Anyone seen this?
UPDATE
It's a while later and I'm working on a different app and I've run into the same problem again. This time downgrading ZenTest didn't resolve it.
回答1:
I had a similar problem which I resolved by downgrading to 4.0.0. Unfortunately I didn't have time to investigate why this happened in the first place, but I would be interested to know.
回答2:
I struggled with this too. It looks like Rails support was removed from the core autotest library and moved into it's own gem. gem install autotest-rails
seems to get everything working for me.
回答3:
I can also confirm that simply installing 'autotest-rails' solved the problem for me without having to downgrade ZenTest to 4.0.0
回答4:
I had the same problem with Shoulda tests, downgrade to 4.0.0 solved it.
sudo gem uninstall ZenTest
answer yes to the remove binaries question
sudo gem install ZenTest --version '4.0.0'
回答5:
I experienced the same problem. Installing the autotest-rails gem solved it for me. I didn't find it necessary to downgrade ZenTest to 4.0.0 (running 4.1.4).
来源:https://stackoverflow.com/questions/1574896/zentest-autotest-not-running-tests