[FRPythoneers] Doctest

Jim Vickroy Jim.Vickroy at noaa.gov
Fri Jul 27 10:50:31 MDT 2001


Mike Olson wrote:

>
> Of course.  My point is, that once code has been developed, then unit
> tests are useless.
>

That may  be true but only if that code will NEVER be changed in any manner.  Unit tests
are a useful aid in demonstrating that a code update has not broken things that worked
prior to the update.

>
> If you, as the developer, fix the bug and update the test harness
> accordingly great.  That one little piece of code is working and now
> (maybe) properly tested.  However, the rest of the system was dependent
> on the previous behaviour and will probably be broken.  So having a unit
> test does you absolutely no good.
>

In my view, the fact that some system components are dependent on errant behavior of one
component says nothing about the usefulness of unit tests.

You probably have heard the drill ...

Find an error in a module.  Update the unit test, for this module, to detect the error.
Fix the error.  Run ALL of your unit tests for ALL of your modules.  If none of the tests
fail for any of the modules, then, at least to the extent your unit tests reflect desired
behavior, you have broken nothing.  If tests fail, fix the broken modules and run all
tests again.  Repeat, until all test succeed.

The fact that bugs are discovered independent of your unit tests says nothing about the
usefulness of unit testing only about the quality of your unit tests which, themselves,
improve over time as they are updated to catch bugs they previously missed.

Unit tests demonstrate (for their coverage domain) what parts of a system do (and do not)
work as expected.   That absolutely is of value to me.

>
> >
> > >  So when
> > > the developer fixes the unit test will break.  If the unit test was what
> > > defined that chunk of codes contract with the rest of the system, then
> > > odds are you just broke the rest of the system.
> > >
> >
> > In my view, unit test do not define a "code chunk's" contract with a system; they,
> > instead, verify correctness for a (limited) range of inputs to the code chunk.  Unit
> > tests say nothing about behavior outside their domain.
>
> By verify correctness with a (limited) range of inputs, you have created
> a contract.  There may be more of a contract, but it us unverifed.  The
> rest of the system becomes dependent on the (implied) contract created
> by the test case.  The contract has to be there even if implied or else
> how do you come up with the limited set of test data?
>
> Mike
>
> >
> > >
> > > Mike
> > >
> > > >
> > > > --
> > > > Luke Jones = luke/vortex/frii/fullstop/com
> > > > _______________________________________________
> > > > This message sent by the FRPythoneers mailing list.
> > > > Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> > > > URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
> > >
> > > --
> > > Mike Olson                                Principal Consultant
> > > mike.olson at fourthought.com                +1 303 583 9900 x 102
> > > Fourthought, Inc.                         http://Fourthought.com
> > > 4735 East Walnut St,                      http://4Suite.org
> > > Boulder, CO 80301-2537, USA
> > > XML strategy, XML tools, knowledge management
> > > _______________________________________________
> > > This message sent by the FRPythoneers mailing list.
> > > Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> > > URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
> >
> > _______________________________________________
> > This message sent by the FRPythoneers mailing list.
> > Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> > URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
>
> --
> Mike Olson                                Principal Consultant
> mike.olson at fourthought.com                +1 303 583 9900 x 102
> Fourthought, Inc.                         http://Fourthought.com
> 4735 East Walnut St,                      http://4Suite.org
> Boulder, CO 80301-2537, USA
> XML strategy, XML tools, knowledge management
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers




More information about the FRPythoneers mailing list