[ANSI-Smalltalk] squeakers

Andres Valloud andres.valloud at gmail.com
Sat Feb 2 10:36:35 GMT 2008


At one point I wrote an SUnit ANSI test suite for collections.  Something I
noticed is that it is quite easy to depend on the feature you want to test
to write the test in the first place.  Particularly when writing tests for
things like Array or SortedCollection, the dependency on at: and at:put:
becomes obvious and the whole exercise appears to become a tautology.

Something I found useful to get out of this situation is to implement
messages such as #firstElement, #secondElement, ..., #fifthElement in the
test case, and then to refer to particular objects that should be found at
given at: indices via those messages.  It makes for a somewhat cumbersome
implementation.  However, it is easier to show that tests written in that
way are more valuable than tests for e.g. at: that rely on at:.

The other issue is that the idea of what is an Array can be expressed as a
test, and yet implementations that comply with the test can be quite
different than what what we would expect them to look like.  For example,
one could make an array as a subclass of Dictionary and while it would pass
all the tests, it may not qualify as straightforward as other possible
implementations.  To a point I think particular situations like these are
unavoidable, and that we should not spend much energy dealing with them.  I
think we should rather concentrate on making sure the test is as far from a
tautology as (with reason) possible.

Andres.

On Jan 25, 2008 12:35 PM, Bruce Badger <bwbadger at gmail.com> wrote:

> On 25/01/2008, Michael Klein <mklein at alumni.caltech.edu> wrote:
> > Well that just begs the question:
> >
> >         How does one determine whether any given test
> >         actually tests for compliance to a specification?
>
> A very good question.  I think that the answer is that neither the
> specifications nor the tests will ever be perfect, but each will help
> the other to trend towards being prefect.
>
> Let me add that the above assumes that we have diligent (but
> different!) people working on the specification and the tests.
>
> --
> Make the most of your skills - with OpenSkills
> http://www.openskills.org/
>
> _______________________________________________
> ANSI-Smalltalk mailing list
> ANSI-Smalltalk at lists.openskills.org
> http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openskills.org/pipermail/ansi-smalltalk/attachments/20080202/cfe1c0f6/attachment.html


More information about the ANSI-Smalltalk mailing list