loris has asked for the wisdom of the Perl Monks concerning the following question:
Hello Testers of Perl,
I am using Test::More to test a module. This worked fine until I had to include a package written by someone else. This package does not work in my test environment because it tries to connect to a database to which I have no access.
So on the one hand, I need to supress the DB-connect and, on the other, I need to provide some dummy information corresponding to that which would have come out of the DB (just an email address).
I have solved the problem by passing a parameter 'test' to my module and then adding a few if-statements to my code to see whether I am in test mode or not.
This works OK, because I only need to make a few changes, but it seems rather inelegant and could become unwieldy in more complex code.
Does anyone know a better way of approaching this problem?
loris (Test::Moron)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Insulating Tests against the Effects of External Modules
by eyepopslikeamosquito (Archbishop) on May 27, 2005 at 09:34 UTC |