FAQ
I've been using a test framework that I wrote (which actually predates
any of the other Test:: modules by 1-2 years) and I finally decided to
rework it as a full-blown module. I was never a fan of the existing
Test:: frameworks because I felt they make it easy to write test
scripts, but the tests are hard to read and use the way I want to.

I use my test scripts in two ways:

1) I use my test scripts to debug my module. When I get a bug report,
I'll add a test case which I know demonstrates a bug to one of the test
scripts, and then I'll debug the test script. Once the module is
debugged, I'll just leave the test case there so (hopefully) the bug
won't come back.

So, in the debugger, I want to be able to trivially do the following:

break at the start of test N

2) Obviously, I use my test scripts to easily see what I'm testing for
and to see if there are any particular combinations of input that I
might need to test for.


In Test::More, a series of tests might look like:

# test 1
$result = func("apples","bushels");
is($result, "enough");

# test 2
$result = func("grapefruit","tons");
is($result, "enough");

# test 3
$result = func("oranges","boatloads");
is($result, "insufficient");

This illustrates both of the missing features I want.


1) If I ran the test and found that test #2 failed, I have to figure out
what line the second call to func is on, run the script in the debugger,
and set a breakpoint there. Not hard... but it breaks the train of
thought, and if instead of 3 tests, there are 300 tests, it might take a
while to figure out where the breakpoint should be.

I much prefer being able to say:

b func ($::TI_NUM == 2)

Additionally, I'd like support for only running a subset of the tests
(one only one specific test), etc. The scripts can also print out more
or less diagnostic information which may reduce the amount of time
needed to debug the problem.

2) Looking at the Test::More script, the script is very simple (thanks
to the very nice Test::More module)... but the TESTS are NOT nice to
read. When I'm working on my test suite, the scripts are almost
completely uninteresting. Once I get it right, it's very likely that
I'll never touch the "script" side of things again, but I may reexamine
the scripts many times (to add new tests, to re-debug one when a new
version of the module breaks something, to examine them in total to see
if there are missing tests). I don't want to write the tests in the form
above (unless that turns out to be the most convenient). I'd prefer to
write the tests in a form in which the tests are very readable, such as:

$tests = "

apples bushels => enough

grapefruit tons => enough

oranges boatloads => insufficient

";

$o->tests(tests => $tests,
func => \&func);

Now, I can quickly see all of the tests in a simple table that I can
trivially understand. I can also see that I forgot to test for "bunches
of bananas", and add that.


So, I finally got around to reworking my framework into a module that
I'll be releasing to CPAN within a few days... but I'm not sure what to
name it.

I'm currently using "Test::Inter" (i.e. interactive tests), but I'm not
a fan of that name since interactive tests are only one of the features
(and the more readable tests are probably more 'important' to most people).

I could go with "Test::Readable", "Test::Flexible", "Test::Most", ...
but none of them are really grabbing me, so I figured I'd just call for
suggestions and go with whatever is suggested.

The complete POD is here:

http://heather.osg.ufl.edu/Test-Inter.html

Thanks for any suggestions

Search Discussions

  • Brian d foy at Apr 21, 2010 at 3:44 pm
    [[ This message was both posted and mailed: see
    the "To," "Cc," and "Newsgroups" headers for details. ]]

    In article <4BCDAE67.4030400@cpan.org>, Sullivan Beck wrote:
    So, I finally got around to reworking my framework into a module that
    I'll be releasing to CPAN within a few days... but I'm not sure what to
    name it.

    I'm currently using "Test::Inter" (i.e. interactive tests), but I'm not
    a fan of that name since interactive tests are only one of the features
    (and the more readable tests are probably more 'important' to most people).

    I could go with "Test::Readable", "Test::Flexible", "Test::Most", ...
    but none of them are really grabbing me, so I figured I'd just call for
    suggestions and go with whatever is suggested.
    Well, Test::Most is taken, and the others don't really identify what
    you are doing.

    It sounds like your major idea is to have table driven tests (which I
    already do with basic Test::More stuff) that are breakable in the
    debugger.

    From your documentation, it looks what you really have is a
    Test::Builder alternative. You might get a lot of good advice about
    names and other things on the qa@perl.org list.

    --
    brian d foy (one of many PAUSE admins), http://pause.perl.org
    PAUSE instructions: http://pause.perl.org/pause/query?ACTION=pause_04about
    Archives: http://www.xray.mpe.mpg.de/mailing-lists/modules
    Please send all messages back to modules@perl.org with no CC to me.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmodules @
categoriesperl
postedApr 20, '10 at 1:38p
activeApr 21, '10 at 3:44p
posts2
users2
websitecpan.org...

2 users in discussion

Brian d foy: 1 post Sullivan Beck: 1 post

People

Translate

site design / logo © 2021 Grokbase