[Chicago-talk] Faking an LDAP server during tests?

Steven Lembark lembark at wrkhors.com
Sun Jun 18 12:08:37 PDT 2006



-- Jonathan Rockway <jon at jrock.us>

> Anyway, any insight would be appreciated.

Perl Testing Programmer's Notebook from O'Reilly
(blue job with the pre-printed coffee stains).

Extreme summary: Write a "fake" module that returns
success/failure for a specific set of calls or a
specific set of data for them. Call that class and
record whether your client code properly recognizes
the exceptions, returns, and failures. No reason you
can't embed the fake class into your .t code.

Once you have tested whether your code can deal with
failures and baseline call syntax appropriately there
really isn't more you can do without a "real" server.

Sub::AutoStub does some of this for you easily by
allowing the methods to return a fixed value via
AUTOLOAD (i.e., saves you from having to hack out
and maintain a bunch of stubs just for the one test).

-- 
Steven Lembark                                       85-09 90th Street
Workhorse Computing                                Woodhaven, NY 11421
lembark at wrkhors.com                                     1 888 359 3508


More information about the Chicago-talk mailing list