YAPC::NA 2007

June 25-27, Houston, TX

Developing a test harness

Developing a test harness

By Steven Lembark (‎Lembark‎) from stlouis.pm
Date: Tuesday, June 26, 2007 09:25 AM
Duration: 20 minutes
Language:

You can find more information on the speaker's site:


My current work requires running thousands of sequential tests to validate modules. Instead of hard-coding each one I've created a structure with method and argument data. The harness wrapes each call in a closure, exeuctes methods and use Test::Deeply to check the results. A breakpoint in the Perl debugger is set on mis-matched values or exceptions, and the closure allows for easy re-execution of problematic operations. The format also has the option of passing out-of-band data to the harness itself for setting pre-test breakpoints or expectnig the next operation to fail. The tests structure can easily be converted to XML or config file formats or generated from scratch.

The talk would describe the basic outlines and how to construct a similar harness for other types of objects.

This harness replaces code like:

$object->method( data1 data2 )

with

[ qw( method data1 data2 ) ],

or

[
[ qw( expected return ) ],
[ qw( method data1 data2 ) ],

]