[TIP] testing: why bother?
alfredodeza at gmail.com
Wed Mar 23 07:03:36 PDT 2011
On Wed, Mar 23, 2011 at 9:34 AM, Laura Creighton <lac at openend.se> wrote:
> I think that the most important reason to write tests is so that they
> can write them _first_, and the code _later_. This will change the way
> they write code, so that they won't produce these large, self-contained,
> too-tightly coupled messes, which just happen to work, and which are
> a nightmare to refactor because they don't decompose nicely.
> However, telling them that they should write tests because their code
> is crappy is unlikely to have the positive effect you want.
Well, it wasn't my intention to say such a thing :) I believe in pointing
the right way
rather than pointing to what is wrong.
> So tell them that they should write tests because it is best way to
> document exactly what a piece of code is supposed to do, by design,
> as opposed to the things it just happens to do but is irrelevant to
> its function. That way, when somebody, often not the original writer
> of the code wants to change it, he knows exactly what it is that he
> has to keep working. And the failures will tell him when he hasn't
> done this properly.
This seems a bit better than talking about BDD to a non-initiated crowd.
> But if 'how do you _know_ this code is correct' hasn't caused them to
> write tests already, then I suspect they are hopeless.
> That whole concept is from outer-space for them. They have not thought
in the way you and I understand it.
It is the same scenario as trying to explain that you are not going to fall
of the face of the
earth because the earth is round to someone that hasn't thought about that
Again, I am just trying to inflict such an impact that they at least give it
to try it out and see for themselves.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python