About test presence

Peter van Rooijen peter at vanrooijen.com
Wed Dec 17 22:20:25 UTC 2003


> Context.
> I think that not showing the tests close to the classes they cover is a
> mistake. I already
> discussed with marcus and we agreed.

I agree too :-).

> Basically this is not efficient
> because: the tests are not present
> so people cannot use them as documentation, cannot learn how to write
> tests, cannot feel the need
> to write tests. I get this feeling more and more so I decided to bring
> the issue and I need your feedback.
>
> Idea.
> I would like to have the tests closely related with the class it
> covers. I would like to have the **simplest
> solution** first

The simplest solution is to put the tests in the classes under test. It
works great. I've implemented this in such a way that the classes test
themselves. It's as if they had a "self-test" button. It works for both
black-box and white-box tests. It's very fast, too.

I've written about this a little in the past and most people rejected the
idea of having test code in the classes under test. I've not been promoting
the system, and have no plans to, but since you brought up the issue, I
thought I'd mention my solution.

Regards,

Peter

> and see how we can improve it and enforce some
> conventions such as the naming of the class and
> the category. I would like to have the minimal modification to the
> environment (because I know that someone
> has to code it) Basically I would like to have a category (because for
> some cases we may need to have other objects
> and classes created. The idea is not to restrict to Unit tests) with
> the name of the class category and -Test and the
> name for the class name XXTest
>
> Integer in Kernel
> would have its tests if any in IntegerTest in Kernel-Test.
>
> I would like to add in the image the corresponding tests that marcus
> collected and produce a removal script (which is trivial).
> Before doing that I would like to know your point of view.
>
> In a second step, I would like to see if and how what romain robbes did
> with the Unit Browser can be used (I would
> remove the Lint box from the browser for example).
>
> Stef
>
>
>




More information about the Squeak-dev mailing list