How to execute perl tests located in several files?
Why following code executes tests from check2.t file only?
#!/usr/bin/perl -w
use strict;
use warnings;
use Modern::Perl;
use TAP::Harness::JUnit;
my $harness = TAP::Harness::JUnit->new({
xmlfile => 'output.xml',
namemangle => 'hudson',
merge => 1
});
$harness->runtests(['che开发者_StackOverflow中文版ck1.t', 'check2.t']);
Actually, it runs the tests from check1.t
while calling it check2.t
. As davorg pointed out, runtests
expects a list of tests, not an arrayref of tests. The reason why it appears to work is that runtests
also allows a test entry to be in the form [ 'filename', 'comment' ]
, where filename
is the name of the test file, and comment
is the string to display. (This is documented in the base class, TAP::Harness.)
Does it even run tests from check2.t? The documentation for the module says that runtests takes a list of test files, not an array reference. Try changing the runtests line to:
$harness->runtests('check1.t', 'check2.t');
精彩评论