Saturday, June 26, 2010

Bio::MEDLINE

There is a unit test for Bio::MEDLINE.
I replaced it into new one.
New Bio::TestMEDLINE tests all of the methods in Bio::MEDLINE and use the same sample file.
It has 100% coverage to Bio::MEDLINE.

Sunday, June 20, 2010

Bio::KEGG

There are 5 files witch don't have the files for unit test.

I skipped Bio::KEGG::Brite, It probably has the same methods as KEGGDB.

Bio::TestBioKEGGEXPRESSION outputs the following result now.
12 tests, 7 assertions, 6 failures, 5 errors
I checked the following error of them.
4) Error:
test_down_regulated(Bio::TestBioKEGGEXPRESSION):
Errno::EDOM: Numerical argument out of domain - log10
    ./lib/bio/db/kegg/expression.rb:128:in `log10'
    ./lib/bio/db/kegg/expression.rb:128:in `logy_minus_logx'
    ./lib/bio/db/kegg/expression.rb:127:in `each'
    ./lib/bio/db/kegg/expression.rb:127:in `logy_minus_logx'
    ./lib/bio/db/kegg/expression.rb:99:in `down_regulated'
    test/unit/bio/db/kegg/test_expression.rb:77:in `test_down_regulated'
The reason is that test_down_regulated gives a negative value to Math.log10.

I skipped Bio::KEGG::KGML because it is just a wrapper class of REXML.

I haven't written Bio::KEGG::Common, Bio::KEGG::KEGGTAB and Bio::KEGG::Taxonomy (the latter two classes may not be so important.).

Bio::GO

Bio::TestGo class tests almost all code in Bio::GO, Bio::GO::GeneAssociation and Bio::GO::External2GO.
It doesn't cover part of dag_edit_format_parser(str).
In addition, It outputs an error in "to_str" method of Bio::GO::GeneAssociation class, because the method doesn't assume empty value in each instance variable.

Bio::Sequence


Bio::Sequence::Format::Formatter
I made fake class witch has only a simple output method to test FormatterBase. The unit test class has the test for output method with the fake class.

Bio::Sequence::Adapter
It has a clss for a data source class connected by the adapter and a class witch is the interface. In addition, it has adapter class witch extends an adapter module. It tests Bio::Sequence::Adapter through the interface class.

Bio::SQL

It has two kinds of unit test.
TestBiosqlIO class in ts_biosql.rb connects and accesses MySQL, so It can tests a execution environment to test whether Bio::SQL works.
tc_biosql.rb has only a require statement of 'tc_biosql', I'm not understand how to use it.
Does it need to test only the logics of the methods in Bio::SQL with the fake class of the database.?

Bio::GenBank

Bio::NCBIDB::Common
It is tested in Bio::NCBIDB::TestCommon. Bio::NCBIDBCommon class includes Bio::NCBIDB::Common. Instead of Bio::NCBIDB::Common, It is used in the unit test. This class has low coverage, because a sample entry used in it lacks a lot of fields. There are all the methods except for "locus" method,which is override in the child class.

Bio::GenBank
its unit test tests the methods in Bio::GenBank, including the methods returning Bio::GenBank::Locus and Bio::Feature objects Should the sample file be simpler than now?

Bio::GenPept
The coverage of this class is 100% It tests only the methods descripbed in the soruce class.(It dosen't test the inherited met hods from NCBIDB)

Bio::DDBJ
I didn't write the unit test, since it has the same methods as Bio::GenBank.
Bio::RefSeq
I didn't write the unit test, since it has the same methods as Bio::GenBank.

Wednesday, June 16, 2010

shift to Characterization test

  • I have to make the unit test for the classes someone made.
  • I have been studying the classes and making the unit tests for them simultaneously.
  • Some class files have the examples of use in the comment statements
This is why I will start to make the tests with Characterization test until now.
Basically, I will prepare a test class for a class, and test the behaviors for the methods.
I won't write tests for private methods. I will write them only for methods that can be accessed externally.
However, even if they are private methods, they should pass C0 test.(I will manage it with rcov.)

Monday, June 14, 2010

design criteria for Unit Test

  • Prepare unit tests for each class.
  • For each module, prepare the mock classes that include each the module
  • When a class is prepared only for internal use or tightly-coupled with another class, I won't prepare the unit test for the class, but prepare it for the central class.

What I did in the second week.

There are some classes which don't have unit tests in the following directories.
appl/
compat/
db/
io/
sequence/
shell/
util/
I'm making unit tests for the classes in db/, such as Bio::PDB::*, Bio::GenBank::*, Bio::KEGG::*.
I'd like to create the unit test completely in the directory within this week.