[ANN] BrowseUnit v4 preview: feedback needed

Colin Putney cputney at wiresong.ca
Fri Mar 5 19:24:55 UTC 2004


On Mar 5, 2004, at 12:22 PM, Markus Gaelli wrote:

> Hi Colin,
>
>> I'm not really sure why,
> so there is hope ;-)
>> but I have a vague feeling that composing tests isn't a good idea. 
>> Why do you want to make the same assertions over and over? Once per 
>> run is enough, no?
>
> If you have composed method examples/tests, you could enhance 
> BrowseUnit/XUnit to only run the necessary high level tests, so that
> all included tests are checked along the way and are not executed 
> stand alone.

I don't see how this would be an improvement. In the example I posted, 
each test gets run exactly once. Even if you enhanced SUnit to keep 
track of which tests had been run as part of a higher-level test, you'd 
still execute the lower level tests multiple times–once for every 
high-level test that called them.

> Thus you
> 	- reduce testing time

No, you increase it.

> 	- get your assertions failing -> find your bugs in the most specific 
> context

I think mocks are a better way to achieve this.

> 	- improve our design: we might think about providing methods in you 
> real program which we can exemplify to get some nice objects:

I think this is a general benefit of careful testing, whether or not 
your tests are composed.

> 	- might thus get rid of some test artifacts / helper methods (not 
> sure about this one)

Not sure about that one either. I don't notice many test artifacts in 
my production code - it just uses the same interfaces as the test code. 
I definitely notice that extensive testing has a design impact on my 
code, but I suspect that's a positive thing. It's hard to say, though, 
what the code would look like if it wasn't tested.

> How could this be done? Say we somehow tag the unit tests which are 
> method examples. Then we should be able to detect their call graphs.
> And then only call the necessary ones to cover the whole graph.

I did something like this using MethodWrappers a while back. The idea 
was to build a coverage analyzer out of it, but I never got around to 
finishing it. It might be worth dusting off.

> Colin



More information about the Squeak-dev mailing list