Re: Unit testing framework suggestions?
Re: Unit testing framework suggestions?
- Subject: Re: Unit testing framework suggestions?
- From: Marco Scheurer <email@hidden>
- Date: Mon, 27 Sep 2004 12:14:26 +0200
On Sep 27, 2004, at 1:47 AM, Marcel Weiher wrote:
Of course you keep them "close" to the tested class, but you still
have an instance of one class testing an instance of another class.
Huh? I have the class testing instance of itself. This seems
perfectly reasonable and has caused me absolutely no problems. Why do
you say an instance of one class testing an instance of another class?
Do you mean an instance of the metaclass??
Yes, you've got method of the class object testing methods of the
instance. These tests are no more internal than when implemented in
another class. In both cases we probably start by instantiating an
instance of the tested class. The testing code that needs to be written
is the same.
And I don't buy the argument that writing tests in a category rather
than a class change the whole perspective on unit testing and how it
makes it so much more integrated in the development activity.
I wouldn't buy it from a purely theoretical point of view either, but
after a little more than 1 year of JUnit (after a number of years with
MPWTest), I can say that it has definitely been the case. YMMV.
Not fair. Comparing testing with Junit and testing with OCUnit is a bit
like comparing programming in Java and programming in Objective C. I
don't like JUnit either.
I'm a fan of categories, but in that case, I don't see the point.
Writing a test using OCUnit and, I suppose, many others is just as
trivial:
@implementation MyTestCase:TestCase
- (void) testWonder1
{
}
@end
Now I have to wonder: you complained above about an instance of one
class testing an instance of a different class (which wasn't the
case), and this is precisely the case here. How is MyTestCase related
to the class being tested?
I was not complaining, but pointing out that having tests as class
methods of the tested class or as instance methods of another class is
not fundamentally different.
MyTestCase is a client of the tested class. It includes its interface.
Again there is no difference, if you decide to move your category in
other files, you would also need to include relevant headers.
One way or another the only required activities are to write test
methods and to run them.
Not quite. At the very least, you need to link in the testing
framework.
Well sure, and your tests run when you don't link to your framework?
Please note that I've said since the beginning that not subclassing
TestCase was also possibility. And I'm not saying that it is
necessarily worse, but that the claims that doing so makes the testing
activity so much better, simpler, easier and enjoyable are wrong in my
opinion.
marco
_______________________________________________
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