[TIP] testing: why bother?

Alex Gaynor alex.gaynor at gmail.com
Wed Mar 23 09:17:33 PDT 2011

On Wed, Mar 23, 2011 at 12:11 PM, Laura Creighton <lac at openend.se> wrote:

> In a message of Wed, 23 Mar 2011 08:37:24 MST, "C. Titus Brown" writes:
> >It may be that we get our students off to a bad start somehow, but my
> >experience with our 2nd and 3rd year students is that they are so
> >immature as programmers that they often don't get what to test for,
> >they have no idea what a "specification" is, and, as a result, their
> >tests are not clear expressions of anything.
> >
> >Or, to put it another way, learning how to test is just as hard as learni
> >ng
> >how to program.  Since we don't know how to teach the latter, it's not
> >clear to me why we would know how to teach the former :)
> <snip>
> I think that learning how to test is a lot more ammenable to rote learning
> than programming in general.  I think that if your students worked their
> way
> through the unitesting chapter in
> http://diveintopython.org/unit_testing/index.html they'd end up with a
> better idea of what a test should be, just through training.  And
> making more training exercises isn't that hard.  Start with ones
> where the specifications are already given, and work your way into
> making the students come up with their own specifications.  One
> fun way we do this here (but these are children, remember) is to
> divide up in teams, and then make specifications, and then make
> tests.  Then develop the code.  And then finally -- make the other
> groups run your tests!  The people with the most complete specifications
> get to watch the others code fail the test.  Great fun around here.
> I also suspect that some of those tests that weren't a clear expression
> of anything were attempts by your students to capture their own thinking
> about how to implement something.  This, too, gets better with practice,
> if only because you learn to stop showing your instructors the 'weird
> idea but not really a test' things.
> Laura
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python

I don't think *anything* in programming is amenable to rote learning, much
less testing.  Writing good tests is an art, there are no hard and fast
rules.  Rules to to do it right is trial and error, and error and error, and
perhaps a few more trials for good measure.


"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20110323/a428e052/attachment.htm>

More information about the testing-in-python mailing list