在Jenkins中实施覆盖率测试

时间:2014-07-03 11:35:55

标签: perl jenkins

我和詹金斯一起完全被困在这里。我正在尝试实施覆盖率报告,以查看我的perl项目的代码覆盖率。为此,我尝试通过构建系统生成报告。

所以我的猜测是,我首先需要准备构建系统,我在执行shell中使用以下命令:

/home/my_user_id/perl5/lib/perl5 Build.PL

执行此命令后,我选择:

./Build testcover

最后,我利用HTML Publisher插件访问HTML文件。

问题在于,我不确定这是否是正确的方法。我的构建总是崩溃,在控制台输出中它说:

 /home/eramatt/perl5/lib/perl5: No such file or directory
 Build step 'Execute shell' marked build as failure

我也没有在项目开始时获得覆盖率报告的任何图标。我在控制台输出中收到此错误消息:

ERROR: Directory '/proj/.../cover_db' exists but failed copying to
                 '/proj/.../htmlreports/Coverage_Report'. 

我搜索谷歌的答案,但没有一个对我有用。如果有人对我有任何提示/提示,请试试我的运气。你可能已经注意到这是我第一次使用Jenkins。

提前致谢

1 个答案:

答案 0 :(得分:0)

您可以尝试安装名为cover

的perl实用程序的Devel::Cover

然后在你的jenkins脚本中做这样的事情

cover -test -report clover  
cover -report html 

#seems the file needs renaming for the cover plugin to see it
mv cover_db/coverage.html cover_db/index.html

在Jenkins中使用Clover Plugin

enter image description here

和你一样的HTML报告 enter image description here

我不确定为什么你的perl副本在你的用户目录中,但你需要确保它对jenkins用户和你自己的用户都可用