[Israel.pm] Testing a library

Shmuel Fomberg semuelf at 012.net.il
Mon Feb 5 13:00:13 PST 2007


Hello There.

I solved my own problem.
I have created a fake XMLRPC::Lite package, and prevented loading the
original by doing 
BEGIN { $INC{'XMLRPC/Lite.pm'} = 'somefile.pm' }

In the fake there are three function:
proxy - checks that the proxy is OK and return a bless ref for the fake
package.
call - test to see that the passed input parameters are acourding to
what suppose to be.
result - return a long list of numbers. 

So I call to each function with a long parameters list (references to
scalars containing numbers 1..9) and checks that the right parameters
where touched. 

I did some other tricks to make the testing more complete, but that's
the principle. 
And for the record, yes. I found a lot of errors. 

It was fun code to write. 

Shmuel. 

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Shmuel Fomberg
Sent: Saturday, February 03, 2007 11:59 PM
To: perl at perl.org.il
Subject: [Israel.pm] Testing a library

Hello There.

I had in work a library that actually was a thin wrapper around
XMLRPC::Lite.
I have replaced it with a new library that I wrote, that suppose to do
the same.
My question is: how do I test it? I need to know that the two libraries
are completely parallel. 
Does XMLRPC::Lite return error if I send the wrong number of parameters?
The wrong type?
I have in the new lib a call table, that is a hash where the key is the
function name, and the values are parameters list. (as in/out) 

Any Idea?

Shmuel.

_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl


-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.22/666 - Release Date:
03/02/2007 15:31





More information about the Perl mailing list