So at $WORK we have a bunch of really large data (immutable) data
structures which a ton of our source code uses. As such, most tests
that we write need to access these data structures to run. These
structures can't (currently) be serialized with Storable due to having
LibXML objects in them (among other reasons).

I have built a class that represents tests for a particular package (or
packages), that can require other tests to be run, can receive data
from the tests that have run before it, and can provide data to tests
that depend on it. Here is a (simplified) example:

Map: builds a map data structure
 Route: using a map, builds a route data structure
  Position: position along a route

In this case, part of the "Map" test is to return a valid Map object,
which Route and Position can use (if they want) as part of their tests.
When you try to run Route's test it automatically finds and runs all of
Route's prerequisites first (in this case Map).

If people are interested I can follow up in more detail.

Obviously this approach has problems and it would be better to just
create what each test needs at its start allowing them to be
independent. In this case, I am dealing with a (very large) legacy code
base whose objects can anywhere from seconds to minutes to be built,
and it's incredibly hard to get people to use a test suite that takes
hours to run (currently it takes about 10 minutes or so).

My questions are:

1. Is there something already out there that can do this? It seems to
cut against the grain of a lot of other testing strategies.

2. (Given the legacy system) Is this a terrible idea? If so, what would
be better? It seems like the best solution for the (bad) situation, but
your collective experience certainly outweighs mine.

3. Is this an issue other people run into? If so, should I try to clean
this up and put it on CPAN?

Thanks,

-- Erik

Reply via email to