[Pdx-pm] Modern testing in perl

Eric Wilhelm enobacon at gmail.com
Sat Mar 6 13:01:28 PST 2010


# from Chad Granum
# on Thursday 04 March 2010 19:10:

Interesting.  You're touching both sides of the TAP wall here though and 
I think it might be useful to consider what can be done from each side 
(and implicitly: why keeping the wall is a good thing.)

These things sound rather consumer/harness-related:
> * Group tests into sets which can be run multiple times under
>   different scenarios
> * Every test file should create an object that is run
> * Test results should be reported to the tester in object form,
>   unlike Test::Builder which just outputs any results directly to TAP.
> * Ability to run just a specified case/set


Where these sound more producer-related:
> * Writing tester function libraries (think Test::More,
>   Test::Exception, etc) should be very simplified
> * Ability to create result handlers for cases where you want to get
>   results directly instead of going straight to TAP.
> * More helpful output in some current testers (is_deeply for example)
> * Ability to define tests both in separate files, and inline with the
>   objects being tested

They interrelate, but I'm just suggesting that it might be useful to 
view them from two directions like this.

If you can structure your tests in a way that allows them to be 
introspected, the harness (given sufficient knobs) can be made to run 
parts or groups of them regardless of what's in which *.t files.  You 
might have another tool which e.g. lets you REPL into a single process 
(which may even be enabled while running under the harness.)

Don't forget about parallelism.  On a related note: preloading code in a 
single process and peeling off a fork for each test (for one instance: 
a daemon which just forks and dumps the requested test's TAP out 
through a client socket in the *.t files.)

Hope that gives you something to think about.  I've never really had a 
chance to organize my thoughts on these matters into code, but you're 
welcome to try!

  http://www.nntp.perl.org/group/perl.qa/2007/12/msg10035.html
  http://www.nntp.perl.org/group/perl.qa/2007/08/msg8998.html

--Eric
-- 
I arise in the morning torn between a desire to improve the world and a
desire to enjoy the world. This makes it hard to plan the day.
--E.B. White
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the Pdx-pm-list mailing list