Re: Test writing

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Test writing

Gabriel Valiente
Sorry about the delay, I've promised to write test files for
Bio::Tree::Draw::Cladogram and Bio::Tree::Compatible much earlier.

I've just submitted t/Compatible.t, a test file for
Bio::Tree::Compatible. There are five simple tests, two of which are
commented out because they need an equality test for Bio::Tree::Tree
objects, which is missing. Any volunteer for writing a tree equality
test? Jason?

Regarding the test file for Bio::Tree::Draw::Cladogram, I just don't
know what to include in the test. The only thing this module does is to
produce a EPS file, and the only thing that comes to my mind is to test
equality of a precomputed EPS file and one produced on the fly for the
same input tree. Any suggestions are welcome.

By the way, can anybody briefly explain why is it necessary to include
prefixes like

my $common = $t1->Bio::Tree::Compatible::common_labels($t2);

in t/Compatible.t, which already uses Bio::Tree::Compatible, instead of just

my $common = $t1->common_labels($t2);

???

Thanks,

Gabriel Valiente

>This message is for module authors and for anyone looking for something to do
>for BioPerl.
>
>
>I've modified the 'maintenance/modules.pl --untested' code so that it reads in
>all test files, extracts 'use'd or 'required' Bio classes, now *recursively*
>marks all super classes and 'use'd classes as tested. In addition, I manually
>ignore all Bio::Search and Bio::SearchIO classes. That is because although
>there are extensive tests for modules in these name spaces, new classes are
>instantiated based on attributes to the constructor. This might be true to
>other classes, too. If this is the case, I can see two possible actions:
>
>
>1. Add them to the list of ignored class names at the end of function
>'untested' in the script.
>
>
>2. If the classes are never called directly, rename them to start with lower
>case letter which by convention means that they are "component classes" like
>Bio::SeqIO::genbank.
>
>
>
>All other classes should have tests written for them or - ultimately - removed
>from the repository.
>
>
>The aim of this exercise is to come up with a first pass list of BioPerl
>classes that do not have any tests written for them and get them written. The
>next pass will be to find untested methods within classes.
>
>
>
>When writing tests, please follow conventions in existing files and remember
>to test all public methods. If you do not have a cvs login, post the new
>tests to bugzilla.bioperl.org, not to the list. We are more than happy to
>give cvs access to anyone committing more than a couple new tests.
>
>
>       -Heikki
>
>
>List of BioPerl classes needing tests:
>
>Bio::Align::Utilities
>Bio::Annotation::AnnotationFactory
>Bio::Annotation::Target
>Bio::DB::Ace
>Bio::DB::Expression
>Bio::DB::Fasta::Stream
>Bio::DB::Flat::BDB
>Bio::DB::Flat::BinarySearch
>Bio::DB::GFF::ID_Iterator
>Bio::DB::Universal
>Bio::DB::XEMBLService
>Bio::Expression::Contact
>Bio::Expression::DataSet
>Bio::Expression::FeatureGroup
>Bio::Expression::FeatureGroup::FeatureGroupMas50
>Bio::Expression::FeatureSet::FeatureSetMas50
>Bio::Expression::Platform
>Bio::Expression::Sample
>Bio::FeatureIO
>Bio::Graphics::FeatureFile::Iterator
>Bio::Graphics::Glyph
>Bio::Graphics::Util
>Bio::Index::Fastq
>Bio::Index::Hmmer
>Bio::LiveSeq::IO::SRS
>Bio::Location::AvWithinCoordPolicy
>Bio::Location::NarrowestCoordPolicy
>Bio::Map::Clone
>Bio::Map::Contig
>Bio::Map::FPCMarker
>Bio::Map::OrderedPositionWithDistance
>Bio::Map::Physical
>Bio::Matrix::PSM::Psm
>Bio::Matrix::PSM::PsmHeader
>Bio::Matrix::Scoring
>Bio::Ontology::InterProTerm
>Bio::Ontology::Path
>Bio::Ontology::SimpleGOEngine
>Bio::OntologyIO::Handlers::InterProHandler
>Bio::OntologyIO::Handlers::InterPro_BioSQL_Handler
>Bio::OntologyIO::InterProParser
>Bio::PrimarySeq::Fasta
>Bio::Root::Err
>Bio::Root::Global
>Bio::Root::IOManager
>Bio::Root::Utilities
>Bio::Root::Vector
>Bio::Root::Xref
>Bio::SeqFeature::Gene::Promoter
>Bio::SeqFeature::PositionProxy
>Bio::SeqFeature::Tools::FeatureNamer
>Bio::SeqFeature::Tools::IDHandler
>Bio::SeqFeature::Tools::TypeMapper
>Bio::SeqIO::FTHelper
>Bio::Structure::SecStr::DSSP::Res
>Bio::Structure::SecStr::STRIDE::Res
>Bio::Taxonomy
>Bio::Taxonomy::Taxon
>Bio::Taxonomy::Tree
>Bio::Tools::AlignFactory
>Bio::Tools::Blast::HSP
>Bio::Tools::Blast::HTML
>Bio::Tools::Blast::Sbjct
>Bio::Tools::Blat
>Bio::Tools::Coil
>Bio::Tools::ESTScan
>Bio::Tools::Eponine
>Bio::Tools::Fgenesh
>Bio::Tools::Gel
>Bio::Tools::Grail
>Bio::Tools::HMM
>Bio::Tools::Hmmpfam
>Bio::Tools::Primer::Feature
>Bio::Tools::Primer::Pair
>Bio::Tools::Prints
>Bio::Tools::Profile
>Bio::Tools::PrositeScan
>Bio::Tools::Run::GenericParameters
>Bio::Tools::Seg
>Bio::Tools::Signalp
>Bio::Tools::Tmhmm
>Bio::Tools::WWW
>Bio::Tools::WebBlat
>Bio::Tree::Compatible
>Bio::Tree::Draw::Cladogram
>Bio::Tree::NodeNHX
>FeatureStore  # in Bio::DB::GFF::Adaptor::berkeleydb.pm
>interpro   # class defined in Bio::SeqIO::interpro, mistake?
>
_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Reply | Threaded
Open this post in threaded view
|

Re: Re: Test writing

Hilmar Lapp

On Dec 28, 2005, at 4:27 AM, Gabriel Valiente wrote:

> Regarding the test file for Bio::Tree::Draw::Cladogram, I just don't
> know what to include in the test. The only thing this module does is
> to produce a EPS file, and the only thing that comes to my mind is to
> test equality of a precomputed EPS file and one produced on the fly
> for the same input tree. Any suggestions are welcome.

If you can't read that file back in then yes I suppose all you can do
is test for equality with a precomputed file. If the EPS is essentially
an image though (as opposed to a vector graphics) then note the
troubles that Lincoln had to go through for testing Bio::Graphics
output because many systems (depending primarily on GD library version
I guess) lead to correct but binary-wise slightly different image
files. If you're in a similar situation then be prepared for asking
people who see the test fail on their platform to send to you the file
that's produced on their system so that you can adjust the test.

>
> By the way, can anybody briefly explain why is it necessary to include
> prefixes like
>
> my $common = $t1->Bio::Tree::Compatible::common_labels($t2);

I don't know why you would want to do that if $t1 is already a
Bio::Tree::Compatible instance (or the module name as a string will do
fine too).

        -hilmar

>
> in t/Compatible.t, which already uses Bio::Tree::Compatible, instead
> of just
>
> my $common = $t1->common_labels($t2);
>
> ???
>
> Thanks,
>
> Gabriel Valiente
>
>> This message is for module authors and for anyone looking for
>> something to do for BioPerl.
>>
>> I've modified the 'maintenance/modules.pl --untested' code so that it
>> reads in all test files, extracts 'use'd or 'required' Bio classes,
>> now *recursively* marks all super classes and 'use'd classes as
>> tested. In addition, I manually ignore all Bio::Search and
>> Bio::SearchIO classes. That is because although there are extensive
>> tests for modules in these name spaces, new classes are instantiated
>> based on attributes to the constructor. This might be true to other
>> classes, too. If this is the case, I can see two possible actions:
>>
>> 1. Add them to the list of ignored class names at the end of function
>> 'untested' in the script.
>>
>> 2. If the classes are never called directly, rename them to start
>> with lower case letter which by convention means that they are
>> "component classes" like Bio::SeqIO::genbank.
>>
>>
>> All other classes should have tests written for them or - ultimately
>> - removed from the repository.
>>
>> The aim of this exercise is to come up with a first pass list of
>> BioPerl classes that do not have any tests written for them and get
>> them written. The next pass will be to find untested methods within
>> classes.
>>
>>
>> When writing tests, please follow conventions in existing files and
>> remember to test all public methods. If you do not have a cvs login,
>> post the new tests to bugzilla.bioperl.org, not to the list. We are
>> more than happy to give cvs access to anyone committing more than a
>> couple new tests.
>>
>>       -Heikki
>>
>>
>> List of BioPerl classes needing tests:
>>
>> Bio::Align::Utilities
>> Bio::Annotation::AnnotationFactory
>> Bio::Annotation::Target
>> Bio::DB::Ace
>> Bio::DB::Expression
>> Bio::DB::Fasta::Stream
>> Bio::DB::Flat::BDB
>> Bio::DB::Flat::BinarySearch
>> Bio::DB::GFF::ID_Iterator
>> Bio::DB::Universal
>> Bio::DB::XEMBLService
>> Bio::Expression::Contact
>> Bio::Expression::DataSet
>> Bio::Expression::FeatureGroup
>> Bio::Expression::FeatureGroup::FeatureGroupMas50
>> Bio::Expression::FeatureSet::FeatureSetMas50
>> Bio::Expression::Platform
>> Bio::Expression::Sample
>> Bio::FeatureIO
>> Bio::Graphics::FeatureFile::Iterator
>> Bio::Graphics::Glyph
>> Bio::Graphics::Util
>> Bio::Index::Fastq
>> Bio::Index::Hmmer
>> Bio::LiveSeq::IO::SRS
>> Bio::Location::AvWithinCoordPolicy
>> Bio::Location::NarrowestCoordPolicy
>> Bio::Map::Clone
>> Bio::Map::Contig
>> Bio::Map::FPCMarker
>> Bio::Map::OrderedPositionWithDistance
>> Bio::Map::Physical
>> Bio::Matrix::PSM::Psm
>> Bio::Matrix::PSM::PsmHeader
>> Bio::Matrix::Scoring
>> Bio::Ontology::InterProTerm
>> Bio::Ontology::Path
>> Bio::Ontology::SimpleGOEngine
>> Bio::OntologyIO::Handlers::InterProHandler
>> Bio::OntologyIO::Handlers::InterPro_BioSQL_Handler
>> Bio::OntologyIO::InterProParser
>> Bio::PrimarySeq::Fasta
>> Bio::Root::Err
>> Bio::Root::Global
>> Bio::Root::IOManager
>> Bio::Root::Utilities
>> Bio::Root::Vector
>> Bio::Root::Xref
>> Bio::SeqFeature::Gene::Promoter
>> Bio::SeqFeature::PositionProxy
>> Bio::SeqFeature::Tools::FeatureNamer
>> Bio::SeqFeature::Tools::IDHandler
>> Bio::SeqFeature::Tools::TypeMapper
>> Bio::SeqIO::FTHelper
>> Bio::Structure::SecStr::DSSP::Res
>> Bio::Structure::SecStr::STRIDE::Res
>> Bio::Taxonomy
>> Bio::Taxonomy::Taxon
>> Bio::Taxonomy::Tree
>> Bio::Tools::AlignFactory
>> Bio::Tools::Blast::HSP
>> Bio::Tools::Blast::HTML
>> Bio::Tools::Blast::Sbjct
>> Bio::Tools::Blat
>> Bio::Tools::Coil
>> Bio::Tools::ESTScan
>> Bio::Tools::Eponine
>> Bio::Tools::Fgenesh
>> Bio::Tools::Gel
>> Bio::Tools::Grail
>> Bio::Tools::HMM
>> Bio::Tools::Hmmpfam
>> Bio::Tools::Primer::Feature
>> Bio::Tools::Primer::Pair
>> Bio::Tools::Prints
>> Bio::Tools::Profile
>> Bio::Tools::PrositeScan
>> Bio::Tools::Run::GenericParameters
>> Bio::Tools::Seg
>> Bio::Tools::Signalp
>> Bio::Tools::Tmhmm
>> Bio::Tools::WWW
>> Bio::Tools::WebBlat
>> Bio::Tree::Compatible
>> Bio::Tree::Draw::Cladogram
>> Bio::Tree::NodeNHX
>> FeatureStore  # in Bio::DB::GFF::Adaptor::berkeleydb.pm
>> interpro   # class defined in Bio::SeqIO::interpro, mistake?
>>
> _______________________________________________
> Bioperl-l mailing list
> [hidden email]
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
--
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------


_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Reply | Threaded
Open this post in threaded view
|

Re: Re: Test writing

Hilmar Lapp

On Dec 29, 2005, at 4:54 AM, Gabriel Valiente wrote:

> Thanks a lot.
>
>>> By the way, can anybody briefly explain why is it necessary to
>>> include prefixes like
>>>
>>> my $common = $t1->Bio::Tree::Compatible::common_labels($t2);
>>
>> I don't know why you would want to do that if $t1 is already a
>> Bio::Tree::Compatible instance (or the module name as a string will
>> do fine too).
>
> I see. The problem is that $t1 is not a Bio::Tree::Compatible instance
> but a Bio::Tree::Tree instance.

Then why do you use the $t1-> notation to start with? You'd instead
write

        my $common = Bio::Tree::Compatible->common_labels($t2);

>
> Perhaps the usual workaround in these situations is to add a dummy
> Bio::Tree::Compatible->new method, that falls back on the
> Bio::Tree::Tree->new method. The advantage would be to allow for a
> more concise use of the Bio::Tree::Compatible methods.

If Bio::Tree::Compatible inherits from Bio::Tree::Tree then you don't
need to implement new() unless you have some special setup to do during
initialization. If you don't inherit from it, then do not fall back on
some other class' new() method() either - otherwise at best you'll
confuse perl or yourself about the inheritance structure.

Hth,

        -hilmar

BTW Please keep threads on the list. There are hundreds of people who
might be able to help you.

>
> Please let me know what you think.
>
> Gabriel
>
>
--
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------


_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Reply | Threaded
Open this post in threaded view
|

Re: Re: Test writing

Jason Stajich
In reply to this post by Gabriel Valiente

On Dec 28, 2005, at 7:27 AM, Gabriel Valiente wrote:

> Sorry about the delay, I've promised to write test files for  
> Bio::Tree::Draw::Cladogram and Bio::Tree::Compatible much earlier.
>
> I've just submitted t/Compatible.t, a test file for  
> Bio::Tree::Compatible. There are five simple tests, two of which  
> are commented out because they need an equality test for  
> Bio::Tree::Tree objects, which is missing. Any volunteer for  
> writing a tree equality test? Jason?
>
As soon as proper equality function is in the toolkit I can fix the  
bootstrap computing code in Bio::Tree::Statistics too.  Not sure when  
I'll have time and have to find a description of a good algorithm for  
doing it.

> Regarding the test file for Bio::Tree::Draw::Cladogram, I just  
> don't know what to include in the test. The only thing this module  
> does is to produce a EPS file, and the only thing that comes to my  
> mind is to test equality of a precomputed EPS file and one produced  
> on the fly for the same input tree. Any suggestions are welcome.
>
> By the way, can anybody briefly explain why is it necessary to  
> include prefixes like
>
> my $common = $t1->Bio::Tree::Compatible::common_labels($t2);
>
> in t/Compatible.t, which already uses Bio::Tree::Compatible,  
> instead of just
>
> my $common = $t1->common_labels($t2);
>
> ???
>
> Thanks,
>
> Gabriel Valiente
>
>> This message is for module authors and for anyone looking for  
>> something to do for BioPerl.
>>
>> I've modified the 'maintenance/modules.pl --untested' code so that  
>> it reads in all test files, extracts 'use'd or 'required' Bio  
>> classes, now *recursively* marks all super classes and 'use'd  
>> classes as tested. In addition, I manually ignore all Bio::Search  
>> and Bio::SearchIO classes. That is because although there are  
>> extensive tests for modules in these name spaces, new classes are  
>> instantiated based on attributes to the constructor. This might be  
>> true to other classes, too. If this is the case, I can see two  
>> possible actions:
>>
>> 1. Add them to the list of ignored class names at the end of  
>> function 'untested' in the script.
>>
>> 2. If the classes are never called directly, rename them to start  
>> with lower case letter which by convention means that they are  
>> "component classes" like Bio::SeqIO::genbank.
>>
>>
>> All other classes should have tests written for them or -  
>> ultimately - removed from the repository.
>>
>> The aim of this exercise is to come up with a first pass list of  
>> BioPerl classes that do not have any tests written for them and  
>> get them written. The next pass will be to find untested methods  
>> within classes.
>>
>>
>> When writing tests, please follow conventions in existing files  
>> and remember to test all public methods. If you do not have a cvs  
>> login, post the new tests to bugzilla.bioperl.org, not to the  
>> list. We are more than happy to give cvs access to anyone  
>> committing more than a couple new tests.
>>
>>       -Heikki
>>
>>
>> List of BioPerl classes needing tests:
>>
>> Bio::Align::Utilities
>> Bio::Annotation::AnnotationFactory
>> Bio::Annotation::Target
>> Bio::DB::Ace
>> Bio::DB::Expression
>> Bio::DB::Fasta::Stream
>> Bio::DB::Flat::BDB
>> Bio::DB::Flat::BinarySearch
>> Bio::DB::GFF::ID_Iterator
>> Bio::DB::Universal
>> Bio::DB::XEMBLService
>> Bio::Expression::Contact
>> Bio::Expression::DataSet
>> Bio::Expression::FeatureGroup
>> Bio::Expression::FeatureGroup::FeatureGroupMas50
>> Bio::Expression::FeatureSet::FeatureSetMas50
>> Bio::Expression::Platform
>> Bio::Expression::Sample
>> Bio::FeatureIO
>> Bio::Graphics::FeatureFile::Iterator
>> Bio::Graphics::Glyph
>> Bio::Graphics::Util
>> Bio::Index::Fastq
>> Bio::Index::Hmmer
>> Bio::LiveSeq::IO::SRS
>> Bio::Location::AvWithinCoordPolicy
>> Bio::Location::NarrowestCoordPolicy
>> Bio::Map::Clone
>> Bio::Map::Contig
>> Bio::Map::FPCMarker
>> Bio::Map::OrderedPositionWithDistance
>> Bio::Map::Physical
>> Bio::Matrix::PSM::Psm
>> Bio::Matrix::PSM::PsmHeader
>> Bio::Matrix::Scoring
>> Bio::Ontology::InterProTerm
>> Bio::Ontology::Path
>> Bio::Ontology::SimpleGOEngine
>> Bio::OntologyIO::Handlers::InterProHandler
>> Bio::OntologyIO::Handlers::InterPro_BioSQL_Handler
>> Bio::OntologyIO::InterProParser
>> Bio::PrimarySeq::Fasta
>> Bio::Root::Err
>> Bio::Root::Global
>> Bio::Root::IOManager
>> Bio::Root::Utilities
>> Bio::Root::Vector
>> Bio::Root::Xref
>> Bio::SeqFeature::Gene::Promoter
>> Bio::SeqFeature::PositionProxy
>> Bio::SeqFeature::Tools::FeatureNamer
>> Bio::SeqFeature::Tools::IDHandler
>> Bio::SeqFeature::Tools::TypeMapper
>> Bio::SeqIO::FTHelper
>> Bio::Structure::SecStr::DSSP::Res
>> Bio::Structure::SecStr::STRIDE::Res
>> Bio::Taxonomy
>> Bio::Taxonomy::Taxon
>> Bio::Taxonomy::Tree
>> Bio::Tools::AlignFactory
>> Bio::Tools::Blast::HSP
>> Bio::Tools::Blast::HTML
>> Bio::Tools::Blast::Sbjct
>> Bio::Tools::Blat
>> Bio::Tools::Coil
>> Bio::Tools::ESTScan
>> Bio::Tools::Eponine
>> Bio::Tools::Fgenesh
>> Bio::Tools::Gel
>> Bio::Tools::Grail
>> Bio::Tools::HMM
>> Bio::Tools::Hmmpfam
>> Bio::Tools::Primer::Feature
>> Bio::Tools::Primer::Pair
>> Bio::Tools::Prints
>> Bio::Tools::Profile
>> Bio::Tools::PrositeScan
>> Bio::Tools::Run::GenericParameters
>> Bio::Tools::Seg
>> Bio::Tools::Signalp
>> Bio::Tools::Tmhmm
>> Bio::Tools::WWW
>> Bio::Tools::WebBlat
>> Bio::Tree::Compatible
>> Bio::Tree::Draw::Cladogram
>> Bio::Tree::NodeNHX
>> FeatureStore  # in Bio::DB::GFF::Adaptor::berkeleydb.pm
>> interpro   # class defined in Bio::SeqIO::interpro, mistake?
>>
> _______________________________________________
> Bioperl-l mailing list
> [hidden email]
> http://portal.open-bio.org/mailman/listinfo/bioperl-l

--
Jason Stajich
Duke University
http://www.duke.edu/~jes12/


_______________________________________________
Bioperl-l mailing list
[hidden email]
http://portal.open-bio.org/mailman/listinfo/bioperl-l