On 5/20/02 9:04 AM, "Dave Thomas" <Dave / PragmaticProgrammer.com> wrote:
> 
> Neither of these apply to Ruby, and yet we still tend to put the unit
> tests in a separate file. So I'm wondering what happens it we break
> that tradition:
> 

I have a couple of concerns with this idea:

1) If the tests are included in the source file won't they be installed with
the library and so loaded/parsed every time the library is used? It would be
possible to have the installers strip tests from the libraries being
installed. I'm not sure what I think of this, my first reaction isn't
positive. Stripping the unit tests while installing also means that the unit
tests have to be written assuming un-installed libraries and won't
necessarily be available to test the installed libraries.

2) In xampl-pp there are about 1400 lines of unit tests split into six files
that test a *single* ruby class of about 950 lines. I consider these tests
to be a bit light too. I don't know if I'd like to give up the organisation
of multiple test files, and I don't know if I'd like to have to organise and
navigate through a single file of 2500 lines. This is made worse by some
unit test organisation techniques I've used on large Java projects --
basically these rely on the fact that the unit test files do *not* have to
be organised in a structure paralleling the code they are testing. I've
tended to use something similar to 'aspects' to organise the tests (e.g.
security, performance, locale, input, output, reporting, ...).

Cheers,
Bob