[Bioperl-l] Test Suite and Test::Exception

Chris Fields cjfields at uiuc.edu
Tue Mar 13 10:14:58 EDT 2007


I always liked the Pugs smoketest system, where Pugs tests can be run  
and you get nice htmlized output, then the results can be sent to a  
smokeserver:

http://m19s28.vlinux.de/cgi-bin/pugs-smokeserv.pl?

It supposedly can be configured to test non-Pugs perl5-related stuff.

chris

On Mar 13, 2007, at 8:49 AM, Nathan Haigh wrote:

> Yep, I agree with using throws_ok{}.
>
> Another thing regarding testing, has anyone thought about having an
> automated test run via cron on CVS HEAD and have the results made
> available on the website?
>
> Nath
>
> Chris Fields wrote:
>> You could add it to t/lib, which is what we do with
>> Test::Simple/More.  It seems like a worthwhile addition.  I have to
>> agree with one of the CPAN reviewers, though, when using it in cases
>> like your example; I would use throws_ok{}, which makes sure an
>> exception was thrown and checks $@ using a qr{} (just to make sure  
>> the
>> exception was the expected one and not something else like a
>> nonexistent file, etc.).
>>
>> chris
>>
>> On Mar 13, 2007, at 7:38 AM, Nathan Haigh wrote:
>>
>>> I've really started looking into tests while writing some of my own
>>> modules and I've found Test::Exception pretty good at testing  
>>> things you
>>> would expect to die and live. I know things like this can be done  
>>> with
>>> an eval block, but Test::Exception is nice and tidy and provides
>>> throws_ok etc to test if a certain message was thrown (using a  
>>> string or
>>> regex). I think it could be pretty useful for use in BioPerl tests,
>>> especially if tests are to be devised to cover some of the metrics
>>> provided by Devel::Cover e.g. Branch coverage.
>>>
>>> For a quick example: test that an error is thrown when providing an
>>> inappropriate parameter to one of the bioperl-run modules (e.g.
>>> Clustalw.pm).
>>>
>>> -- start test code --
>>> #  Build a clustalw alignment factory
>>> my @params = ('unknown_param_name' => 2);
>>> $factory = Bio::Tools::Run::Alignment::Clustalw->new(@params);
>>> dies_ok{  Bio::Tools::Run::Alignment::Clustalw->new(@params);}
>>> "Correctly died when using an unknown parameter";
>>> -- end test code --
>>>
>>> However, Test::Exception isn't installed by default. In addition,  
>>> these
>>> types of tests could inflate the test suit - is this, or could  
>>> this be
>>> an issue?
>>>
>>> Anywho, any thoughts on this?
>>> Nath
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>> Christopher Fields
>> Postdoctoral Researcher
>> Lab of Dr. Robert Switzer
>> Dept of Biochemistry
>> University of Illinois Urbana-Champaign
>>
>>
>>
>

Christopher Fields
Postdoctoral Researcher
Lab of Dr. Robert Switzer
Dept of Biochemistry
University of Illinois Urbana-Champaign





More information about the Bioperl-l mailing list