We're starting to write some rather complex business applications that
include a lot of business rules and I've come up against a bit of a
conundrum: how to best test things that aren't unit-testable. Let me
explain.

We've gotten rather efficient at writing unit tests, using Devel::Cover
(understanding its shortcomings) to track our progress, although we try our
best to write our tests along side our code. When we were implementing
relatively simple business rules, a la:

if ( $some_condition ){
  &require_this_field();
}
else{
  &require_that_field();
}

...we can basically cover that functionality with a unit test that goes
through and tests both branches effectively. However, our business rules
have gotten complicated enough that we are no longer writing them that way
explicitly in the code. In the last application we built, we put the rules
in a database and the appropriate ones were pulled based on circumstances
(using generalized code) and run. Now we're embarking on something different
that allows us to essentially write our business rules declaratively,
although it's taken care of by a module that we can assume is fully tested
(details will be forthcoming at some point, methinks).

In this situation, we would still like something in place to ensure that
altering the construction of the business rules doesn't cause regression in
the application, but we can't (or I'd certainly rather not) simply write
unit tests for. It's also not something that really needs to be done by the
developers per se, as they can essentially black box the code, testing for
output based on input. I'm thinking that it's about time we started
formalizing having staff with QA duties who write functional tests against
the code.

Does this sound sensible? If so, what tools could you recommend? Should we
still just use Test::More but in a more simple manner? Should we write mech
tests instead (these are web apps)? Or are there other tools that would be
useful? It seems to me that it would be rather laborious to write all of
these tests by hand.

Any insight appreciated. Recommendations on good books on general testing
philosophy would also be helpful (I've already got the developer's
notebook).

Andrew

-- 

Andrew Gianni - Lead Programmer Analyst
University at Buffalo, State University of New York
Computing and Information Technology / Administrative Computing Services
215 MFAC, Ellicott Complex, Buffalo, NY 14261-0026
716.645.3587x7124 - AIM: andrewsgianni - http://schoolof.info/agianni

Reply via email to