Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^5: Test::Class and test organization

by xdg (Monsignor)
on Mar 22, 2006 at 05:54 UTC ( #538418=note: print w/replies, xml ) Need Help??

in reply to Re^4: Test::Class and test organization
in thread Test::Class and test organization

It sounds like what you really may need is something along the lines of Test::Trait (not yet written) rather than Test::Class.

When I was writing tests to fix Sub::Uplevel, I needed to test a lot of variations of nested regular and upleveled function calls. As I had just read Higher Order Perl, I realized that my test cases could be described by a tree, so I wrote a recursive function to generate and check all my test cases. While the patch isn't incorporated yet, the problem and patch are posted on RT.

If you think your problem is really N-dimensional -- meaning that you want to test all the combinations of individual variations you described, then you might want to consider doing something similar and just traverse all the combinations.

I think the challenge will be trying to describe the test variations sufficiently orthogonally that you can easily combine them. (E.g. concurrent access can't be toggled on/off as easily as key filters.) I think you're going to want to figure that out before worrying about organizing your test files and data.

Personally, my initial thought on this is to implement the core discrete tests in a utility module. Then I would create a test script along these lines:

use Test::More; use qw( run_core_tests core_test_plan ); sub generate_cases { # returns AoH with toggles for which variations should be used for e +ach case # e.g. { filter_keys => 1, filter_values => 0, change_values => sub +{ } } # # adjust the complexity of cases generated to suit your needs } my @cases = generate_cases(); plan tests => core_test_plan() * @cases; run_core_tests( $_ ) for @cases;

Of course, the core test utility would need to know what to do with the various toggles.


Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://538418]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2020-01-24 04:17 GMT
Find Nodes?
    Voting Booth?