Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54963

Re: automated unit test generation

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.python
Subject Re: automated unit test generation
Date 2013-09-28 11:07 -0700
Organization Nightsong/Fort GNOX
Message-ID <7x4n94vn0a.fsf@ruckus.brouhaha.com> (permalink)
References <2d5fdac0-5145-428b-908e-98be65ba7bab@googlegroups.com>

Show all headers | View raw


skunkwerk <skunkwerk@gmail.com> writes:
> - how difficult/tedious is writing unit tests, and why?

The important thing is to write the tests at the same time as the code.
If you do that, it's not too bad.  It means the code is then organized
around the tests and vice versa.  Keeping tests in sync with changes to
code can be annoying and it's easy to let that slip under schedule
pressure.  After that happens enough, you've got a non-TDD program.

Writing tests for code that's already been written without automated
testing in mind is much more difficult and tedious.  Automatically
generating tests for already-written code also seems dubious.

Also, unit tests themselves are fairly easy, but often you also have to
write mock objects to run the tests on and interpret the results.
That's actually taken more thought when I've done it.  I haven't used
the new Python framework for it yet though.

> - do you wish you had better code coverage?

Sure, we could all use that.  On the other hand it slows down
development if you overdo it.  It's a trade-off like anything else.

> - how important is testing to you?

If you mean TDD and automated testing, it's very helpful if you're doing
something intricate, or if it needs frequent changes and redeployment,
etc.  For more straightforward tasks, manually testing while you code is
ok, especially if it's the type of code for which smoke testing is
enough to tell whether the code works.  So like anything else, it's a
trade-off based on the features and priorities of the task at hand.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

automated unit test generation skunkwerk <skunkwerk@gmail.com> - 2013-09-28 10:12 -0700
  Re: automated unit test generation Paul Rubin <no.email@nospam.invalid> - 2013-09-28 11:07 -0700

csiph-web