Re: SenTestCase order?
Re: SenTestCase order?
- Subject: Re: SenTestCase order?
- From: Chris Hanson <email@hidden>
- Date: Wed, 11 Apr 2007 21:01:53 -0700
On Apr 11, 2007, at 8:08 PM, Jack Repenning wrote:
Is the order in which SenTestingKit calls the SenTestCase methods
predictable? More to the point, controllable? It sure isn't the
order in which I declare them. In at least some projects and runs,
it appears to be alphabetical, but can I trust that?
Your tests should really be written as if they will be run in a
randomized order. The OCUnit that's included with Xcode does try to
run tests in a deterministic order but I don't believe there's any
actual guarantee to that effect.
The reason I ask: I just botched the retain/release balance in a
project, during some refactoring. The unit tests immediately fell
over dead, as they should (yay, unit tests), but my progress in
isolating the flaw was a bit slow because the first test to actually
croak tests functions that are actually dependent on some other
methods. If the tests for the simpler functions had been run first,
I would have had a lot less code to examine. So, that got me
thinking about ways to ensure the testing goes in the most helpful
order.
The easiest way to start tracking down something like this is to run
your unit test suite under the debugger with NSZombieEnabled=YES in
your otest executable's environment variables. You'll get a message
in the log (and an exception) whenever an over-released object is
messaged, which you can use in conjunction with the messages about
what tests are executing to figure out which test is having trouble.
Similarly, you can run your unit tests in the debugger under
libgmalloc to diagnose other lower-level memory issues.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden