--- Paul Johnson <[EMAIL PROTECTED]> wrote:

> Now I can see uses for knowing whether or not you are being run as
> part
> of an installation, or in some automated environment, and I can
> imagine
> someone would have a use for HARNESS_ACTIVE, though I can't see it
> myself, but I'm not sure this is it.
> 
> And I'm afraid I didn't understand the paragraph about RUNNING_TESTS.
> Perhaps it's just me, but if you don't get any sensible comments on
> that you might want to try that paragraph again.

Well, as a general rule, one wants to minimize any reliance on
knowledge of testing in one's code, but the fact remains that when one
is working with ugly code, sometimes it can be very difficult to
refactor complicated bits out so that they can be easily overridden by
tests (this tends not to be the case with clean code).  Thus, when one
has really bad code that shouldn't be run while testing, it can be
useful to have such an environment variable.

Note that I see no problem with testing hooks which make code easier to
override, but code shouldn't have knowledge of tests per se.  That
being said, in the real world, it's not always practical to avoid this,
particularly when you are adding tests to an old, untested code base
and you need to get tests in place prior to refactoring.

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to