Need feedback on simple idea

Andreas Raab andreas.raab at gmx.de
Sat Apr 12 23:31:36 UTC 2003


Nevin,

I don't think you got the point of what I was saying - which was that the
overhead required to set up everything for testing a single method is too
high. I'm sure there are many arguments against having tests literally
embedded in methods (the major one probably that it breaks the "test first"
approach) but I was mostly referring to the environment. For example, if you
harden out some of those conventions then the environment could help you
incredibly if you've just written a method Foo>>bar. When you indicate that
you want to write a test, the system could automatically:
* provide a category "FooBar-Tests" (depending on the category your class
resides in)
* provide a "TestCase subclass: #FooTests"
* add a method "testBar"
* hand you an editor for this test
All of the above have to be done manually right now and even in the best
case it'll cost you a couple of minutes during which you are simply diverted
from what you really want to do. By the end of the day that's what gets into
people's way if they just hack along.

If you make it hard for people to write tests, then no tests will be
written. 

Cheers,
  - Andreas

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org 
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On 
> Behalf Of Nevin Pratt
> Sent: Sunday, April 13, 2003 1:03 AM
> To: The general-purpose Squeak developers list
> Subject: Re: Need feedback on simple idea
> 
> 
> 
> 
> 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