Unit testing - suitable for all development?
Terry Reedy
tjreedy at udel.edu
Mon Mar 8 23:44:07 EST 2004
"Greg Ewing (using news.cis.dfn.de)" <wmwd2zz02 at sneakemail.com> wrote in
message news:c2j9ea$1ug17d$1 at ID-169208.news.uni-berlin.de...
> It sounds like you have a similar situation as I have
> with Pyrex. The Pyrex compiler is made up of a large
> number of parts which interact in very complex ways.
> Each part on its own is fairly simple, and while it
> *could* be tested on its own after a fashion, this
> wouldn't really help much, because most of the
> interesting things happen in the interactions between
> the parts, rather than inside the parts themselves.
>
> I haven't bothered doing unit testing in the conventional
> sense with Pyrex. What I have instead is a large collection
> of very small Pyrex files, each of which exercises some
> feature of the Pyrex language. Running the test consists
> of compiling the file and checking that the generated code
> matches previously verified output.
The main test files for the Python interpreter are similar, testing that
0+1==1, 2*2==4, 'a'+'a'=='aa', [0,1][1]==1, and so on for hundreds of
compile and execute cases intended to cover every syntax feature possible.
Perhaps the OP can do something similar: set up minimal game world and
repeatedly direct a simple action ('pick up nearest object') and check for
intended change of state (inventory contains small dagger that it did not
before).
Terry J. Reedy
More information about the Python-list
mailing list