是否有可能让Devel :: Cover生成的覆盖率统计信息显示在Hudson的项目视图中,就像Cobertura插件一样?即使是模糊的想法也受到赞赏!
答案 0 :(得分:2)
经过大量的研究,稀疏的文档混合了一些以上的试验&错误,这是我想出的一个提炼版本。
#!/usr/bin/perl -w
use strict;
use warnings;
{
use TAP::Harness::JUnit;
use English qw( -no_match_vars $EXECUTABLE_NAME );
}
my $harness = TAP::Harness::JUnit->new(
{ xmlfile => 'results.xml',
exec => [
$EXECUTABLE_NAME,
"-I/repo/trunk/PerlLib",
'-MDevel::Cover=-silent,1,-coverage,all',
'-w',
],
package => 'ARC::FB',
}
);
$harness->runtests(
[ "/repo/trunk/ARC/FB/Base/basic.t" => 'Base.basic.t' ],
[ "/repo/trunk/ARC/FB/Base/copy_file.t" => 'Base.copy_file.t' ],
[ "/repo/trunk/ARC/FB/Base/create_file.t" => 'Base.create_file.t' ],
[ "/repo/trunk/ARC/FB/Base/new.t" => 'Base.new.t' ],
[ "/repo/trunk/ARC/FB/Base/report.t" => 'Base.report.t' ],
[ "/repo/trunk/ARC/FB/Lurker/build_data_file.t" => 'Lurker.build_data_file.t' ],
[ "/repo/trunk/ARC/FB/Lurker/cleanup.t" => 'Lurker.cleanup.t' ],
[ "/repo/trunk/ARC/FB/Lurker/remove_file.t" => 'Lurker.remove_file.t' ],
[ "/repo/trunk/ARC/FB/Lurker/write_config.t" => 'Lurker.write_config.t' ],
[ "/repo/trunk/ARC/FB/Sign/add_tokens.t" => 'Sign.add_tokens.t' ],
[ "/repo/trunk/ARC/FB/Sign/interpret.t" => 'Sign.interpret.t' ],
[ "/repo/trunk/ARC/FB/Sign/new.t" => 'Sign.new.t' ],
);
__END__
将上述程序保存在/usr/local/bin/harness.pl中,然后配置Jenkins作业以在shell中执行:
cover -delete
/usr/bin/perl -w /usr/local/bin/harness.pl
cover -report clover
然后添加两个构建后的操作:
保存&跑吧。
关键概念:
JUnit转换的TAP数据在Jenkins中呈现得很好。但是,Clover报告缺少源覆盖视图。当您深入查看最终三叶草报告链接时,Jenkins会提供404页面。
这是在Jenkins ver 4.478上使用Clover插件版本4.0.6-h-1。
答案 1 :(得分:0)
将TAP::Formatter::JUnit等自定义TAP格式设置与Devel::Cover或Devel::CoverReport的prove_cover结合使用