[Bioperl-l] test::more template
Nathan Haigh
N.Haigh at sheffield.ac.uk
Thu Oct 19 17:17:33 UTC 2006
Quoting Chris Fields <cjfields at uiuc.edu>:
> > I thought I'd have my first proper try at writing some tests. I was
> > wondering if there is a template test file that I should use/study in
> > order to be
> > consistent with other tests.
> >
> > Failing that - Is there a good test writing style I should follow in one
> > of the other test files?
> >
> > Thanks
> > Nathan
>
> I would start with the Test::Simple and Test::More perldoc; they're pretty
> self-explanatory. You can look at the various test suites using Test::More
> as well for pointers. By far, most tests will use is(). You can use SKIP
> blocks to skip tests that have a requirement, or skip all tests if they all
> require something. Pretty flexible.
>
> We should probably get a wiki page for the developers underway, maybe a
> HOWTO on writing tests. At least have these focus on BioPerl, OOP, remote
> DB tests, etc.
>
> Chris
>
> Christopher Fields
> Postdoctoral Researcher - Switzer Lab
> Dept. of Biochemistry
> University of Illinois Urbana-Champaign
>
>
Just wrote a partial and small test script for t/Amap.t in bioperl-run. When I run "perl -I. t/Amap.t" I get the following output:
1..10
ok 1 - use Bio::Tools::Run::Alignment::Amap;
ok 2 - use Bio::AlignIO;
ok 3 - use Bio::SeqIO;
ok 4 - use Bio::Root::IO;
ok 5 - All the required modules are present
ok 6 - new() returned something
ok 7 - and its the right class
not ok 8 - executable() got the correct filename
# Failed test 'executable() got the correct filename'
# in t/Amap.t at line 90.
# got: undef
# expected: 'filename'
ok 9 # skip Got incorrect filename for executable
ok 10 # skip Got incorrect filename for executable
# Looks like you failed 1 test of 10.
So far this looks good (well, that it's failing passing expected tests). However, when i run "make test" the output is unexpected and I don't know
why. It seems to die and produce the results of the testing before the rest of the test suit is run:
t/Amap....................NOK 8
# Failed test 'executable() got the correct filename'
# in t/Amap.t at line 90.
# got: undef
# expected: 'filename'
# Looks like you failed 1 test of 10.
t/Amap....................dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 8
Failed 1/10 tests, 90.00% okay (less 2 skipped tests: 7 okay, 70.00%)
t/Analysis_soap...........ok 7/17make: *** wait: No child processes. Stop.
Is there something I'm missing?? If it's something less obvious, let me know and i'll post whole test file.
Nath
More information about the Bioperl-l
mailing list