[TIP] testing: why bother?

Laura Creighton lac at openend.se
Wed Mar 23 09:11:24 PDT 2011


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




More information about the testing-in-python mailing list