GithubHelp home page GithubHelp logo

spork-testunit's People

Contributors

arronmabrey avatar bmorearty avatar calebhearth avatar joliss avatar jpartlow avatar kbrock avatar mrkcor avatar nixme avatar ordinaryzelig avatar oriolgual avatar seven1m avatar timcharper avatar yhara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spork-testunit's Issues

Running tests with Rake

is it possible to run tests using a rake task? or do we have to use the testdrb utility?

It would be really great to stick to the known syntax, i.e. rake test and the likes, especially for easy integrations with Travis CI.

thanks!

Spork is not reloading changed file

# Put in some good code
.
.
.
$ bundle exec spork testunit
Using TestUnit
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8988!

$ testdrb -Itest test/unit/
.
.
.
# Got all green
.
# Put in some totally bad code e.g asdfasdf
.
$ testdrb -Itest test/unit/
.
.
.
# Still got all green!
# Restart spork server (without changing any code)
.
.
$ testdrb -Itest test/unit/
.
.
.
# Test failed

I'm using:

  • Mac OS X 10.8.2
  • Ruby 1.9.3-p194
  • Rails 3.2.6
# Gemfile

group :development, :test do
  gem 'spork-testunit', '~> 0.0.8'
  gem 'guard-spork', '~> 1.2.0'
end

group :tools do
  gem 'guard-test', '~> 0.5.0'
end
# test_helper.rb

require 'rubygems'
require 'spork'
#uncomment the following line to use spork with the debugger
# require 'spork/ext/ruby-debug'

Spork.prefork do
  # Loading more in this block will cause your tests to run faster. However,
  # if you change any configuration or code from libraries loaded here, you'll
  # need to restart spork for it take effect.

  ENV["RAILS_ENV"] = "test"
  require File.expand_path('../../config/environment', __FILE__)
  require 'rails/test_help'

  class ActiveSupport::TestCase
    # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
    #
    # Note: You'll currently still have to declare fixtures explicitly in integration tests
    # -- they do not yet inherit this setting
    fixtures :all

    # Add more helper methods to be used by all tests here...
  end
end

Spork.each_run do
  # This code will be run each time you run your specs.

end

recycled object error

I am using MRI 1.9.3, Rails 3.2.1, spork 0.9.0, test-unit 2.4.5, and spork-testunit. Regardless of whether I use spork-testunit 0.0.7 or the latest git master, I get this 'recycled object' error from bundle exec testdrb:

Error executing -Itest ./test/functional/admin/assignments_controller_test.rb ./test/functional/admin/availabilities_controller_test.rb ./test/functional/admin/events_controller_test.rb ./test/functional/admin/people_controller_test.rb ./test/functional/admin/roles_controller_test.rb ./test/functional/events_controller_test.rb ./test/functional/people_controller_test.rb ./test/functional/replies_controller_test.rb ./test/functional/routes_test.rb ./test/functional/sessions_controller_test.rb
0x474231e is recycled object
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:375:in `_id2ref'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:375:in `to_obj'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1410:in `to_obj'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1708:in `to_obj'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:613:in `recv_request'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:908:in `recv_request'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1523:in `init_with_client'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1535:in `setup_message'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1487:in `perform'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
(druby://127.0.0.1:8988) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
(druby://127.0.0.1:59689) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1548:in `write'
(druby://127.0.0.1:59689) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
(druby://127.0.0.1:59689) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
(druby://127.0.0.1:59689) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
(druby://127.0.0.1:59689) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
(druby://127.0.0.1:59689) /home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:348:in `output_single'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:337:in `output'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:265:in `output_statistics'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:106:in `block in finished'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:53:in `change_output_level'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/console/testrunner.rb:105:in `finished'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/util/observable.rb:78:in `call'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/util/observable.rb:78:in `block in notify_listeners'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/util/observable.rb:78:in `each'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/util/observable.rb:78:in `notify_listeners'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/testrunnermediator.rb:64:in `run_suite'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/testrunner.rb:40:in `start_mediator'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/testrunner.rb:25:in `start'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/ui/testrunnerutilities.rb:24:in `run'
/home/adam/.rvm/gems/[email protected]/gems/test-unit-2.4.5/lib/test/unit/autorunner.rb:368:in `run'
/home/adam/.rvm/gems/[email protected]/gems/spork-testunit-0.0.6/lib/spork/test_framework/test_unit.rb:49:in `run_tests'
/home/adam/.rvm/gems/[email protected]/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:13:in `block in run'
/home/adam/.rvm/gems/[email protected]/gems/spork-0.9.0/lib/spork/forker.rb:21:in `block in initialize'
/home/adam/.rvm/gems/[email protected]/gems/spork-0.9.0/lib/spork/forker.rb:18:in `fork'
/home/adam/.rvm/gems/[email protected]/gems/spork-0.9.0/lib/spork/forker.rb:18:in `initialize'
/home/adam/.rvm/gems/[email protected]/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:9:in `new'
/home/adam/.rvm/gems/[email protected]/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:9:in `run'
/home/adam/.rvm/gems/[email protected]/gems/spork-0.9.0/lib/spork/server.rb:48:in `run'
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/home/adam/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
------------------------------
Done.

I experimented with trimming the list of tests run, and found that it is triggered by any test which has an error (not a failure). When triggered, one of two things happen: (1) the above stack trace, or (2) what should be the summary line in the output (e.g. something like 20 tests, 106 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications) actually ends up being complete garbage, e.g.

$ bundle exec testdrb -Itest ./test/functional/admin/roles_controller_test.rb
Loaded suite Admin::RolesControllerTest
Started
E
===================================================================================================
Error:
test_should_get_index(Admin::RolesControllerTest):
ActionView::Template::Error: wrong number of arguments (4 for 5)
    lib/admin/controller_tests.rb:60:in `block in <module:Index>'
===================================================================================================


Finished in 0.972404894 seconds.
                                                                                                  Ie:ptionParser::Arguable[        I"
                                  -Itest:ETI"5./test/functional/admin/roles_controller_test.rb;TI"0./test/functional/people_controller_test.rb;TI"1./test/functional/replies_controller_test.rb;T:@optparse0
0% passed

3.09 tests/s, 11.31 assertions/s

So it looks to me like some memory pointer has gone AWOL and this string just gets plucked from a random memory area. Ouch!

Given that it is the summary line which goes FUBAR, I strongly suspect that this is related to issue #33. However, this happens even after I manually edited testdrb to prevent it getting confused by the presence of the minitest gem.

This is the final straw for me. I've had endless woes trying to get Spork and Guard to play nice with both test-unit and minitest, so I'm going to switch to RSpec which is hopefully a more well-trodden and reliable path.

Exception raised when running Rails performance tests

Hello,

Here's me setup:

  • Ruby 1.9.2 p290
  • rails 3.2.3
  • spork 0.9.0
  • spork-testunit 0.0.8

When Spork encounters a Rails performance test via the testdrb command I'm getting a Exception encountered: #<SystemExit: exit> message. Here's the backtrace:

/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/testing/performance/ruby.rb:5:in `exit'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/testing/performance/ruby.rb:5:in `rescue in <top (required)>'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/testing/performance/ruby.rb:1:in `<top (required)>'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/testing/performance.rb:311:in `<top (required)>'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.3/lib/action_dispatch/testing/performance_test.rb:1:in `<top (required)>'
/Users/alistair/Code/Ruby/xxxxxx/test/performance/browsing_test.rb:4:in `<top (required)>'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/collector/load.rb:105:in `block in collect_file'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/collector/load.rb:125:in `add_load_path'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/collector/load.rb:103:in `collect_file'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/collector/load.rb:40:in `block (2 levels) in collect'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/collector/load.rb:34:in `each'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/collector/load.rb:34:in `block in collect'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/collector/load.rb:125:in `add_load_path'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/collector/load.rb:30:in `collect'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/autorunner.rb:83:in `block in <class:AutoRunner>'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/autorunner.rb:360:in `[]'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/test-unit-2.4.8/lib/test/unit/autorunner.rb:360:in `run'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/spork-testunit-0.0.8/lib/spork/test_framework/test_unit.rb:88:in `run_tests'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:13:in `block in run'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0/lib/spork/forker.rb:21:in `block in initialize'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0/lib/spork/forker.rb:18:in `fork'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0/lib/spork/forker.rb:18:in `initialize'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/alistair/.rvm/gems/ruby-1.9.2-p290/gems/spork-0.9.0/lib/spork/server.rb:48:in `run'
/Users/alistair/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/Users/alistair/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/Users/alistair/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/Users/alistair/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/Users/alistair/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'

Any ideas?

Thanks

Why do I have to manually load some models?

I have a model in app/models/API/foursquare.rb.

If I do not put

require File.dirname(__FILE__) + '/../app/models/API/foursquare'

in

Spork.prefork {}

the model is not loaded with the application.

Also, some models are not automatically reloaded I do not understand why. Am I missing something?

Thanks :)

Relative filepaths to tests

Currently an absolute path is output, i.e.,

testdrb -Itest test/unit/break_test.rb

Loaded suite break_test.rb
Started
........E....................
Finished in 2.139565 seconds.

  1) Error:
test_should_have_site_id_set(BreakTest):
RuntimeError: 
    /test/unit/break_test.rb:22:in `test_should_have_site_id_set'
    activesupport (2.3.14) lib/active_support/testing/setup_and_teardown.rb:62:in `__send__'
    activesupport (2.3.14) lib/active_support/testing/setup_and_teardown.rb:62:in `run'

#<DRb::DRbUnknown:0x1e314e8>

but I expect a relative path, i.e.,

ruby -Itest test/unit/break_test.rb

Loaded suite test/unit/break_test
Started
........E.....................
Finished in 1.926428 seconds.

  1) Error:
test_should_have_site_id_set(BreakTest):
RuntimeError: 
    test/unit/break_test.rb:22:in `test_should_have_site_id_set'
    activesupport (2.3.14) lib/active_support/testing/setup_and_teardown.rb:62:in `__send__'
    activesupport (2.3.14) lib/active_support/testing/setup_and_teardown.rb:62:in `run'

30 tests, 72 assertions, 0 failures, 1 errors

Note the test/unit/break_test.rb vs. /test/unit/break_test. I even seen in a test of your's for Spork & Rspec you check to make sure the paths are relative. So would it be possible to have something similar?

testdrb fails on Ruby 1.9.3

Calling testdrb with or without arguments on Ruby 1.9.3-p0 fails with the following error message:

------------------------------
Error executing 
undefined method `setup_argv' for Test::Unit:Module
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/spork-testunit-0.0.7/lib/spork/test_framework/test_unit.rb:29:in `run_tests'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:13:in `block in run'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/spork-0.9.0.rc9/lib/spork/forker.rb:21:in `block in initialize'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/spork-0.9.0.rc9/lib/spork/forker.rb:18:in `fork'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/spork-0.9.0.rc9/lib/spork/forker.rb:18:in `initialize'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:9:in `new'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/spork-0.9.0.rc9/lib/spork/run_strategy/forking.rb:9:in `run'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/spork-0.9.0.rc9/lib/spork/server.rb:48:in `run'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/home/ubuntu/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
------------------------------

It's working fine on 1.9.2 for me.

Getting load error

Using Spork from master:

$ bundle exec testdrb test/unit/blog_post_test.rb
Exception encountered: #<LoadError: no such file to load -- test/unit/blog_post_test.rb>
backtrace:
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in require' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inblock in require'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:227:in load_dependency' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:inrequire'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/collector/load.rb:100:in block in collect_file' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/collector/load.rb:117:inadd_load_path'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/collector/load.rb:99:in collect_file' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/collector/load.rb:39:inblock (2 levels) in collect'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/collector/load.rb:33:in each' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/collector/load.rb:33:inblock in collect'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/collector/load.rb:117:in add_load_path' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/collector/load.rb:29:incollect'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/autorunner.rb:83:in block in <class:AutoRunner>' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/autorunner.rb:311:in[]'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/autorunner.rb:311:in run' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/spork-testunit-0.0.4/lib/spork/test_framework/test_unit.rb:10:inrun_tests'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/run_strategy/forking.rb:13:in block in run' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/forker.rb:21:inblock in initialize'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/forker.rb:18:in fork' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/forker.rb:18:ininitialize'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/run_strategy/forking.rb:9:in new' /home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/run_strategy/forking.rb:9:inrun'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/server.rb:48:in run' /home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1558:inperform_without_block'
/home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1518:in perform' /home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1592:inblock (2 levels) in main_loop'
/home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:in loop' /home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:inblock in main_loop'

test result summary missing and #<DRb::DRbUnknown:0x1017d08a0> in its place

I commented about this in your other issue, but didn't realize it was already closed. So, I thought it might be best to open up a new issue for it just in case it's overlooked. I thought I would also add that I'm using test-unit 2.

I'm experiencing the same weirdness as brian. For example, running testdrb in my terminal works perfectly:
>testdrb test/unit/customer_test.rb
Loaded suite customer_test.rb
Started
.....
Finished in 4.544192 seconds.
5 tests, 7 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications

Yet, if I do the following:
>testdrb test/unit/customer_test.rb > output.txt
> cat output.txt
Loaded suite customer_test.rb
Started
.....
Finished in 4.537602 seconds.

#<DRb::DRbUnknown:0x1017d08a0>

You also can get this identical strange output if you just run the testdrb command in textmate from a system() call or equivalent.
I was sort of able to fix it in textmate by wrapping my call to testdrb in a PTY.spawn block, but the output still isn't quite right...

-Chris

testdrb -Itest test/**/*_test.rb not working

Hi.

When I try testdrb -Itest test/*_/__test.rb, only files in test/unit are launched ("Running tests with args" gives me the list).
Files in other test/ subdirectories are missing.

Out of curiosity I also tried testdrb -Itest test///__test.r, which gives me test/functionnal/, test/integration/, test/unit/helpers/_ but not test/unit/*.

undefined method `setup_argv' for Test::Unit:Module

Looks like the setup_argv method isn't available. I am running ruby 1.9.2 and rails 3.1.rc4. Here is the backtrace

/Users/trcarden/.rvm/gems/ruby-1.9.2-p180@global/gems/spork-testunit-0.0.5/lib/spork/test_framework/test_unit.rb:20:in run_tests' /Users/trcarden/.rvm/gems/ruby-1.9.2-p180@global/gems/spork-0.8.5/lib/spork/run_strategy/forking.rb:13:inblock in run'
/Users/trcarden/.rvm/gems/ruby-1.9.2-p180@global/gems/spork-0.8.5/lib/spork/forker.rb:21:in block in initialize' /Users/trcarden/.rvm/gems/ruby-1.9.2-p180@global/gems/spork-0.8.5/lib/spork/forker.rb:18:infork'
/Users/trcarden/.rvm/gems/ruby-1.9.2-p180@global/gems/spork-0.8.5/lib/spork/forker.rb:18:in initialize' /Users/trcarden/.rvm/gems/ruby-1.9.2-p180@global/gems/spork-0.8.5/lib/spork/run_strategy/forking.rb:9:innew'
/Users/trcarden/.rvm/gems/ruby-1.9.2-p180@global/gems/spork-0.8.5/lib/spork/run_strategy/forking.rb:9:in run' /Users/trcarden/.rvm/gems/ruby-1.9.2-p180@global/gems/spork-0.8.5/lib/spork/server.rb:47:inrun'
/Users/trcarden/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1558:in perform_without_block' /Users/trcarden/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1518:inperform'
/Users/trcarden/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1592:in block (2 levels) in main_loop' /Users/trcarden/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1588:inloop'
/Users/trcarden/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'

including this gem removes normal test visual feedback

Visual feedback is no longer displayed after adding this gem to my bundle and running a test WITHOUT spork (ruby test/unit/user_test.rb):

.....F..E..etc...

This is useful information. It lets me know the progress of the test and if it's hanging or not.

Despite spork being awesome, I still, occasionally want to run tests without it. I don't think spork should interfere with that process, and I don't think I should have to comment out the gem line and bundle everytime I want to do so.

Thanks! :)

0.0.6 tries to require unavailable libraries in 1.9.2

After upgrading to 0.0.6, test no longer run on 1.9.2:

$testdrb -I test/ test/unit/address_test.rb
/Users/ylansegal/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- test/unit/testresult (LoadError)
    from /Users/ylansegal/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/ylansegal/.rvm/gems/ruby-1.9.2-p290@locum/gems/spork-testunit-0.0.6/bin/testdrb:7:in `<top (required)>'
    from /Users/ylansegal/.rvm/gems/ruby-1.9.2-p290@locum/bin/testdrb:19:in `load'
    from /Users/ylansegal/.rvm/gems/ruby-1.9.2-p290@locum/bin/testdrb:19:in `<main>'

As you can see, I am using ruby 1.9.2. After I downgrade to 0.0.5, everything works as expected:

$ testdrb -I test/ test/unit/address_test.rb
Loaded suite ["test/", "test/unit/address_test.rb"]
Started
..
Finished in 1.887994 seconds.

2 tests, 16 assertions, 0 failures, 0 errors, 0 skips

Test run options: --seed 29527
==============================================================================

As I side note for others that might have this problem. Even though I specifically asked for 0.0.5 in my Gemfile and ran bundle again, I was still seeing the same problem because I was neglecting to run 'bundle exec' before testdrb.

Exceptions not caught properly (1.8.7?)

Not sure if this is a version difference in Ruby but the rescue clause at line 42 of test_unit.rb does not seem to be catching all exceptions properly under 1.8.7. Currently it reads:

rescue => e

which does not appear to catch MissingSourceFile exceptions. Changing the line to

rescue Exception => e

resolves the problem. Not sure if this patch would introduce other issues.

Wrong number of arguments exception

Using Spork from master:

$ bundle exec testdrb ./test/unit/user_test.rb 

Error executing 
wrong number of arguments (3 for 2)
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-            2.1.2/lib/test/unit/ui/console/testrunner.rb:29:in `initialize'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/redgreen-1.2.2/lib/redgreen.rb:17:in `initialize'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/ui/testrunnerutilities.rb:24:in `new'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/ui/testrunnerutilities.rb:24:in `run'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/test-unit-2.1.2/lib/test/unit/autorunner.rb:319:in `run'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/gems/spork-testunit-0.0.4/lib/spork/test_framework/test_unit.rb:10:in `run_tests'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/run_strategy/forking.rb:13:in `block in run'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/forker.rb:21:in `block in initialize'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/forker.rb:18:in `fork'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/forker.rb:18:in `initialize'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/run_strategy/forking.rb:9:in `new'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/run_strategy/forking.rb:9:in `run'
/home/sirup/.rvm/gems/ruby-1.9.2-p0@aviastridchat/bundler/gems/spork-0a437df35201/lib/spork/server.rb:48:in `run'
/home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/home/sirup/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'

How do I run the entire test suite?

Hi there,

Before, I used to simply type rake and my entire suite would run. Now I find that I have to type testdrb -I test test/unit/* test/functional/* test/functional/*/* test/integration/*. I have to add the test/functional/*/* because I have nested resources.

Now, I could alias this to make my life easier, but is there a way to run my entire suite easily that I'm not seeing?

-a

Documentation suggestion

require 'test_helper' unless defined?(Spork)
seems to work better than:
require 'test_helper' unless Spork.using_spork?
since the latter will fail if Spork is not used and test_helper is not included :-)

not work with ruby1.9.3

I use ruby 1.9.3 pre,and got errors:

bundle exec testdrb -Itest test/integration/posts_test.rb
/Users/doabit/.rvm/gems/ruby-1.9.3-preview1/gems/spork-testunit-0.0.6/bin/testdrb:7:in `require': cannot load such file --     test/unit/testresult (LoadError)
from /Users/doabit/.rvm/gems/ruby-1.9.3-preview1/gems/spork-testunit-0.0.6/bin/testdrb:7:in `<top (required)>'
from /Users/doabit/.rvm/gems/ruby-1.9.3-preview1/bin/testdrb:19:in `load'
from /Users/doabit/.rvm/gems/ruby-1.9.3-preview1/bin/testdrb:19:in `<main>'

testdrb path confusion

Using:

  • spork (0.9.0.rc9 5119287)
  • spork-testunit (0.0.7 fcf5306)
  • rails (3.1.3)
    and
    ruby 1.9.2p180

Running:

testdrb -Itest test/unit/eligibility_criterion_test.rb 

fails with:
Exception encountered: LoadError: no such file to load -- test/unit/eligibility_criterion_test.rb

but

testdrb -Itest unit/eligibility_criterion_test.rb 

works.

Since specifying a test when running tests via rake is usually relevant to the project directory e.g.:
but

rake test:units TEST=test/units/foo_test.rb

it seems like following this same pattern would be most familiar to most devs.

Regardless, , it doesn't seem clear to me from the README that the path to the test file when calling testdrb is relative to the test directory instead of the project directory.

I would suggest either changing the path or improving the README.

Thoughts?

No tests run using testdrb

New to Ruby so please bear with me... I am using JRuby on Windows, spork-0.9.0.rc9. I am able to use rake test fine but when I try with testunit using testdrb my tests are not run. For example:

testdrb -Itest test\functional\contents_controller_test.rb
Loaded suite contents_controller_test
Started

Finished in 0.113000 seconds.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
<-- Slave(2) run done!

Whereas using rake test:

rake test TEST=test\functional\contents_controller_test.rb
c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53 warning: already initialized constant WFKV_
Loaded suite c:/dev/apps/jruby-1.6.4/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_test_loader
Started

ContentsControllerTest:
PASS should create content (0.19s)
PASS should destroy content (0.03s)
PASS should get edit (0.29s)
PASS should get index (0.22s)
PASS should get new (0.06s)
PASS should show content (0.04s)
PASS should update content (0.05s)

Finished in 0.880000 seconds.

7 tests, 17 assertions, 0 failures, 0 errors, 0 skips

Any suggestions?

passing -n simpletest

As I see you can execute 1 test inside a .rb test file

like http://flavio.castelli.name/2010/05/28/rails_execute_single_test/

But doing testdrb -I test/ test/integration/my_flows_test.rb -- -n test6 doesn't execute test6 inside my_flows I found the -- from semaperepelitsa/spork-minitest#1

I can run testdrb -I test/ test/integration/my_flows_test.rbbut now executing the whole file is taking to much (was thinking of move my failing test to other place... ๐Ÿถ )

Thanks for your help or clarification.

Doesn't reload code

I set up spork and my test helper as per the Wiki and I started it up. I ran the testdrb command on an integration test and it passes as expected. Then I modify a method in a controller to raise an error. Running the test again does not give a failure.

Starting up spork again shows the failure. If I fix it, while spork is still running, it does not pick up the fix.

Using Capybara, Ruby 1.9, Rails 3.1 and Spork-testunit


require 'rubygems'
require 'spork'

Spork.prefork do 
  ENV["RAILS_ENV"] = "test"
  require File.expand_path('../../config/environment', __FILE__)
  require 'rails/test_help'

  #get capybara working
  require 'capybara/rails'
  class ::ActionDispatch::IntegrationTest
    include Capybara::DSL
  end

end

class ActiveSupport::TestCase
  # Add more helper methods to be used by all tests here...
end

#<DRb::DRbUnknown:0x007fdfb22d2898> instead of summary

Upon moving to 0.0.7 from 0.0.6, I now get #DRb::DRbUnknown:0x007fdfb22d2898 instead of the summary line (x tests, x assertions, x failures, etc...). Solely rolling back to 0.0.6 in my gemfile fixes the issue. The tests appear to be running because I do get visual feedback of the failure/error if one occurs.

Why do I have to manually load some models?

I have a model in app/models/API/foursquare.rb.

If I do not put

require File.dirname(__FILE__) + '/../app/models/API/foursquare'

in

Spork.prefork {}

the model is not loaded with the application.

Also, some models are not automatically reloaded I do not understand why. Am I missing something?

Thanks :)

Missing framework error

I installed the gems as per :

gem 'spork', '~> 0.9.0.rc', :group => [:development, :test]
gem 'spork-testunit', :group => [:development, :test]

then modified my test_helper.rb as per your wiki page.

Then I tried to run spork (from within the project root folder) as :

spork testunit --bootstrap (also tried without --bootstrap)

I get the error

"Couldn't find a supported test framework that begins with 'testunit' ..."

I'm using rails3 on windows.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.