Need feedback on simple idea
Nevin Pratt
nevin at smalltalkpro.com
Sat Apr 12 23:03:04 UTC 2003
Andreas Raab wrote:
>. It
>can be tremendously hard to guess in which class exactly you may find a test
>(if any) for a certain method.
>
>
>
Convention does just fine for me.
In my code, the test for:
Item>>taxAmount
would be found in:
ItemTestCase>>testTaxAmount.
and you can easily find it every time.
Some tests are for class functionality not represented by a single
method, but rather a group of methods. They can be considered 'Class
unit tests' (or any one of a number of names you desire to use) rather
than 'method unit tests'. For such tests, for class 'Item', they will
always be found in 'ItemTestCase'.
As to embedding tests within the classes being tested, this has been
hashed over many times in the comp.lang.smalltalk group as well as
elsewhere. Also, many years ago I've read things written by Kent Beck
comparing the pros and cons of each approach, as well as his rationale
for eventually choosing to separate the tests from the classes being
tested. After careful consideration, I found myself agreeing with him,
and then dismissing the entire issue as a *non*issue afterwards.
Anybody wishing to revisit that decision would also be advised to
revisit the old literature on the issue (via google, I presume). I
especially would recommend googling Kent Beck's original writings on the
topic.
Nevin
More information about the Squeak-dev
mailing list
|