Problems with TestUnit

  • Thread starter Dmitry V. Sabanin
  • Start date
D

Dmitry V. Sabanin

Hello,

Were there any major changes to TestUnit work since ruby version 1.7?
My tests worked just before I've setup ruby 1.8.1(from cvs), maybe problem is not
in TestUnit at all, but I need to now, if there were something that might break the
tests written for older versions of TestUnit.
The problem is that tests behavior is kind of insane.
I have this test case runner, run_tests.rb(see comments):

require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'tests/test_bla1.rb'
require 'tests/test_bla2.rb'
require 'tests/test_bla3.rb'

#
# Ruby never comes to this place now, the results are shown up already.
# I'm woundering why is this happening? The strange thing is also that
# test case in test_bla2.rb doesn't checked at all, but in test_bla3.rb
# it is.
#

class TS_WebTests
def self.suite
suite = Test::Unit::TestSuite.new "The Bla Library Tests"
suite << TC_Bla1.suite
suite << TC_Bla2.suite
suite << TC_Bla3.suite
return suite
end
end

Test::Unit::UI::Console::TestRunner.run(TS_WebTests)
 
N

Nathaniel Talbott

Were there any major changes to TestUnit work since ruby version 1.7?

Yes. Quite a few, actually. I can't think of a change off the top of my
head that should break code like this, though.

My tests worked just before I've setup ruby 1.8.1(from cvs), maybe
problem is not
in TestUnit at all, but I need to now, if there were something that
might break the
tests written for older versions of TestUnit.
The problem is that tests behavior is kind of insane.

Can you do a couple of things for me?

- What is the output of -v for the ruby you're running this with?
- Try running with -d and make sure there are no unexpected exceptions
that are being thrown. There was an issue with Test::Unit masking
exceptions that has been resolved very recently.
- Any chance you can send me the offending code? It would help a lot in
finding the problem.

Also, you can check out the thread beginning with
http://www.ruby-talk.org/86899 for some possible solutions to a similar
problem.

HTH,


Nathaniel

<:((><
 
D

Dmitry V. Sabanin

Can you do a couple of things for me?

- What is the output of -v for the ruby you're running this with?
There are some warnings but they are not related to problem.
- Try running with -d and make sure there are no unexpected exceptions
that are being thrown. There was an issue with Test::Unit masking
exceptions that has been resolved very recently.
Oooops..
I found the problem, one of the files was not loaded in 'require', but I didn't
see exception. Why TU hides exceptions, and how can I work around that?
How do you think, adding -d to a ruby she-bang line of run_tests.rb is fine?
Anyway, thanks a lot for your help and for a best testing framework I've ever seen!
 
N

Nathaniel Talbott

There are some warnings but they are not related to problem.

Actually, I was looking for the version (including date) of Ruby you're
using.

Oooops..
I found the problem, one of the files was not loaded in 'require', but
I didn't
see exception. Why TU hides exceptions, and how can I work around that?
How do you think, adding -d to a ruby she-bang line of run_tests.rb is
fine?
Anyway, thanks a lot for your help and for a best testing framework
I've ever seen!

This should be fixed in the latest CVS. If for some reason you can't
use that, -d is the suggested work-around.

HTH,


Nathaniel

<:((><
 
D

Dmitry V. Sabanin

Actually, I was looking for the version (including date) of Ruby you're
using.
Oh, sorry, I didn't understand that :)
My version is:
ruby 1.8.1 (2003-11-10) [i686-linux]
This should be fixed in the latest CVS. If for some reason you can't
use that, -d is the suggested work-around.
Strange, I just upgraded my cvs version, and I have the same problem without -d.
I guess I need to investigate some more, maybe ruby looks for TestUnit files in wrong load
path..
 
N

Nathaniel Talbott

Actually, I was looking for the version (including date) of Ruby
you're
using.
Oh, sorry, I didn't understand that :)
My version is:
ruby 1.8.1 (2003-11-10) [i686-linux]

That version would definitely be affected by the bug. Any version dated
December or later should not be.

Strange, I just upgraded my cvs version, and I have the same problem
without -d.
I guess I need to investigate some more, maybe ruby looks for TestUnit
files in wrong load
path..

Well I've just checked, and it definitely seems to be working correctly
in the most recent CVS:

ntalbott@jacob:~/cvs/ruby$ ruby -v t.rb
ruby 1.8.1 (2003-12-05) [powerpc-darwin]
t.rb:3: unhandled exception
ntalbott@jacob:~/cvs/ruby$ cat t.rb
require 'test/unit'
raise
ntalbott@jacob:~/cvs/ruby$

So yes, you might be requiring an old set of Test::Unit files. Let me
know if you can't get it working.

HTH,


Nathaniel

<:((><
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top