[TIP] A quick guide to testing (for the khmer project)
lac at openend.se
Thu Jul 24 13:20:26 PDT 2014
In a message of Thu, 24 Jul 2014 04:04:06 -0700, "C. Titus Brown" writes:
>thanks for the comment -- rather than lay down further rules (it's hard
>enough for people to sort through our documentation!) I'd like to link to
>discussions. Do you have suggestions for a good, concise discussion of
>the difference between unit tests and functional tests?
Here is one.
Something you didn't mention is 'When can I delete a test? How do I
tell when it is no longer needed?' The reason that this is important
to mention is that if your students are anything like mine, they will
start with the idea that 'now that I have everything working properly,
I can go about deleting these tests and tidy things up a bit'. (Of
course, we are doing TDD.) There _is_ a certain amount of cleanup you
can do, but my students tend to do way, way, way more than this unless
they are explicitly told to stop deleting tests so that the next poor
soul to come along can read them and find out what the code is up to.
Mostly it takes _becoming_ the next poor soul to modify somebody else's
code to teach them that one 'for good'. Even if you are not doing TDD
(which I think is a shame) I think you should be teaching your students
how to take a set of requirements and turn them into a set of tests.
Otherwise, if the student has to leave with his or her project half-done,
you may have to toss all their work and start all over again with a new
student. I find it easier to get a new student to complete existing work
if it already comes with a set of tests it should pass when it is
complete. (And sometimes the reason that it wasn't competed is that
the code is garbage, and should be thrown away, but that's a different
problem. :) )
Best of luck,
More information about the testing-in-python