Re: Unit testing framework suggestions?
Re: Unit testing framework suggestions?
- Subject: Re: Unit testing framework suggestions?
- From: Georg Tuparev <email@hidden>
- Date: Sun, 26 Sep 2004 22:44:04 +0200
On Sep 26, 2004, at 8:23 PM, Marco Scheurer wrote:
On Sep 26, 2004, at 19:25, Christian Pekeler wrote:
On Sep 26, 2004, at 5:37, Marco Scheurer wrote:
Another difference is of course that by writing the tests in a
category, you have access to the internal state of the class (like
the ivar tableWindow), and you do not need access methods...
A good suite of unit tests enables refactoring. However, if the tests
access internals of the production code, the tests are getting in the
way of refactoring (because they would always need to be changed
together with the production code). That's why I think ideally unit
tests should only test the public/official api, for which categories
are not necessary.
Oh yes, I agree totally. I did not see this as an advantage, just a
difference.
Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
Wait a second folks. I thought the discussion was about Unit Tests and
not about Acceptance Tests. Besides, if I cannot tests internals of a
class, who will give me the courage to refactor these internals? Often
these internals make more then 90% of the class. For example a
Telescope class might have a public method isTracking that simply
returns a BOOL ivar set by an internal method called 10x each second
that that corrects the geometry of the flex mirror, reads a frame from
the helper CCD, does some nasty image convolution, calls eigen vectors
based RMS routine and passes the result to a weighting function that
finally decides if the telescope is still tracking or the object was
lost. For a user of the class Telescopes these might be unimportant
details, but for me - the author of the class - these are the most
important methods, and I would like to be able to test them no matter
if someone have academic or other objections...
BTW, a good suite of tests enables refactoring by first braking few
existing tests! If I make even a simple refactoring, say "rename
method", and my test bar is still green I know I am in trouble and I do
not have enough tests! When the tests are broken, I start fixing them.
When the bar is green again, I commit. If the bar stays red for longer
then an hour, I revert.
Georg Tuparev
Tuparev Technologies
Klipper 13
1186 VR Amstelveen
The Netherlands
Mobile: +31-6-55798196
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden