On Fri, Apr 02, 2004 at 02:19:03PM -0600, Andy Lester wrote:

> > Does that mean the test scripts are full of "copy/paste coding"?
> > So if there is a bug in the test up routine, it would be propagated
> > everywhere.
> 
> That is indeed potentially the case.  OTOH, once the code works, then
> changes to it are intentionally painful.
> 
> > It seems reasonable to break with the ideal of "self
> > contained tests" a bit and put shared test setup/tearcode code into  
> > a re-usable testing module. (which itself might have a single set of
> > tests run against it). 

Refactor the duplicated code.

Most of my Devel::Cover tests look something like:

  use Devel::Cover::Test;
  my $test = Devel::Cover::Test->new("trivial");
  $test->run_test

And my Gedcom tests:

  use Basic (resolve => "unresolve_xrefs", read_only => 0);

Coding tests is just like coding anything else.  Possibly more so,
because bugs in the tests themselves are a real pain.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to