Testing Questions

Pete Sergeant pete at clueball.com
Mon May 14 13:02:47 BST 2007


Some assorted questions about testing:

* Do you aim for 100% code coverage? Pro: everytime I manage it, I
tend to zap a bunch of edge-case bugs; Cons: tends to lead to fragile
tests that know far too much about how the thing you're testing is
implemented

* To what degree do you try and separate programmer-generated unit
tests, and tests generated by a test engineer? Do you make any
distinction between regression tests and acceptance tests?

* At what point are you actually writing your tests? Before you start
writing code? During the time you write code? Once the code is written?
Something else?

* Does anyone else add extra targets to their make files? I tend to have
a 'test_coverage' target that runs the tests using Devel::Cover. Anyone
do anything else that's interesting here?

* I tend to use t::lib::FooBar 't/lib/FooBar.pm' to put testing
libraries in. Anyone have a better suggestion? How do you share these
between codebases?

* Do you use subdirectories in t/ for different classes of test? We have
a project with 60 test files with 1400 tests in it, but getting this to
work involved some Makefile.PL trickery. Any thoughts?

* I tend to name tests with preceeding numbers to make them easy to
tab-complete to: t/foobar/030_logging_020_file_based.t - anyone have an
improvement on this?

* Is anyone auto-generating tests for their APIs? Documentation? If so,
how?

Thoughts welcome :-)

+Pete



More information about the london.pm mailing list