I sarted using test/unit today, and have a quick question that wasn't
answered by a quick google:
Right now (ruby 1.8.1) if one of my assertions fail, my test termiates
early to report the error. Is it possible to have it complete *all*
tests, and then give a report at the end? I have some bugs whose
nature may be better elucidated if I can see the results of the other
tests.
Obviously, I can go in and comment out the failed tests so as to
ensure the others are reached, but this seems like the hard way...
I sarted using test/unit today, and have a quick question that wasn't
answered by a quick google:
Right now (ruby 1.8.1) if one of my assertions fail, my test termiates
early to report the error. Is it possible to have it complete *all*
tests, and then give a report at the end? I have some bugs whose
nature may be better elucidated if I can see the results of the other
tests.
Obviously, I can go in and comment out the failed tests so as to
ensure the others are reached, but this seems like the hard way...
Can you just split the test into smaller ones?
···
--
'The old 'give em a Linux box and they think they're Jean-Luc Picard' syndrome.'
-- Pete Bentley
Rasputin :: Jack of All Trades - Master of Nuns
Though that is certainly a viable solution, it is not ideal. For
example, I have one test run which attempts 10 assertions on a single
method with varying parameter values. 5 of these assertions failed
(yes, my method obviously has some issues ). This meant running
the test 5 times, and after each run I had to go comment out the known
failed assertions so I could find out what else did or did not work.
Or, I could have written out 10 different smaller tests ... but to me
that seems to break the logic of wanting to run like assertions
together in the same test ... after all, they were all on the same
method and testing the same logic. If, later down the line I want to
run these tests again, but not *all* of the tests in my suite, I would
have to pass each test_name at the command line. This seems to make
unit testing more complicated than it should be (which I admit is
still nicer than unit testing in any other language I've used). Is
asking test/unit to run all assertions in a test regardless of outcome
not possible then?
Is asking test/unit to run all assertions in a test regardless of outcome
not possible then?
No, it is not possible. It's not even an easy hack on the framework. I've considered it, particularly for functional/acceptance testing, but haven't gotten around to deciding if it's a good idea or not.
I could have written out 10 different smaller tests ... but to me
that seems to break the logic of wanting to run like assertions
together in the same test ... after all, they were all on the same
method and testing the same logic. If, later down the line I want to
run these tests again, but not *all* of the tests in my suite, I would
have to pass each test_name at the command line. This seems to make
unit testing more complicated than it should be (which I admit is
still nicer than unit testing in any other language I've used).
Note that if you gave these related tests a similar name, you could run them all in one fell swoop from the command line using a regex. Also, if they're sufficiently similar, you could even generate the test methods at runtime, which might reduce any redundancy between them.
Note that if you gave these related tests a similar name, you could run
them all in one fell swoop from the command line using a regex. Also,
if they're sufficiently similar, you could even generate the test
methods at runtime, which might reduce any redundancy between them.
Using a regex hadn't occurred to me. And thanks for the response (I
think it is wonderful that one can get such prompt responses from so
many of the library devs here on ruby-talk!)
On 17 Feb 2005, at 17:15, Nathaniel Talbott wrote:
On Feb 17, 2005, at 17:27, Belorion wrote:
I could have written out 10 different smaller tests ... but to me
that seems to break the logic of wanting to run like assertions
together in the same test ... after all, they were all on the same
method and testing the same logic. If, later down the line I want to
run these tests again, but not *all* of the tests in my suite, I would
have to pass each test_name at the command line. This seems to make
unit testing more complicated than it should be (which I admit is
still nicer than unit testing in any other language I've used).
Note that if you gave these related tests a similar name, you could run them all in one fell swoop from the command line using a regex. Also, if they're sufficiently similar, you could even generate the test methods at runtime, which might reduce any redundancy between them.