[TIP] testing: why bother?
kumar.mcmillan at gmail.com
Wed Mar 23 08:18:27 PDT 2011
On Wed, Mar 23, 2011 at 8:34 AM, Alfredo Deza <alfredodeza at gmail.com> wrote:
>> > One thing to consider though is to think about the problem from their
>> > perspective: "Why do I need to write tests?"
I think there are two camps of non-testers. 1) those who don't
understand tests but are probably keen to learn. 2) those who don't
understand *testing* and have tried and failed. The second group have
all sorts of excuses like it slows them down or that the tests require
unnecessary maintenance or that when the tests break it's not a real
error. The second group is tainted and will be harder to convince.
How long is your presentation? :)
There are many benefits to testing but I think these are some key
realistic scenarios you could use to convince people:
- You have a release ready to go but you need to make a last minute
change. It's faster to push out a release when you have tests. You
just run the test suite vs. pointing and clicking for hours. You want
to be sure the release is going to work, right?
- You want to upgrade a major library you use for your entire site
(say, Django) but you're not sure what will break. You've read
through the changelog and spent hours grepping through your code and
even more time pointing and clicking. Some pages won't load and the
exception is confusing. If you had a test suite you would see
instantly what is failing and you'd probably see it at a more granular
level if you had smaller integration tests.
- Your users keep hitting exceptions in your code that you thought you
fixed. In development you thought you saw the problem but it was hard
to set up the scenario to raise the exception so you didn't fully fix
it. This is what tests and mock objects are for.
- You have a team of developers and you want a new team member to work
on a part of the site he's unfamiliar with. He will be frightened.
He will spend a week just exploring the code to try and understand it
in fear of breaking it. If he had a test suite he could just run it.
Tests make developers less frightened.
I'm glad you're presenting on this. It's important.
>> It's hard to convince people to take vitamins (do things that will make
>> their lives better in the future) but it's not hard to get them to take
>> aspirin (do things to relieve a present pain). Perhaps if you knew the
>> kinds of pain they are feeling and showed them that tests could help,
>> you could get through to them.
> Great analogy! It is hard to tell the problems they want to solve though so
> I am aiming to be as generalized about it as possible.
>> > I know that I get the best quality testing-related answers here :)
>> An appeal to vanity; you're already on the road to mass persuasiveness.
>> Benji York
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
More information about the testing-in-python