如何让Jenkins从代码覆盖范围中排除整个文件夹? [英] How to get Jenkins to exclude entire folders from code coverage?

查看:1304
本文介绍了如何让Jenkins从代码覆盖范围中排除整个文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何从詹金斯(Jenkins)发起的jacoco生成的代码覆盖率报告中排除文件夹列表.

I'm trying to figure out how to exclude a list of folders from the code coverage report generated by jacoco, which is launched by Jenkins.

似乎可以排除类,但不能排除文件夹,这对我来说很烦,因为我已经开始将一个很大的图书馆用于在线支付系统.运行这些单元测试意味着在该平台上不断创建测试帐户,而必须再次删除它们.詹金斯每一个尖齿都会奔跑.

It seems possible to exclude classes, but not folders, which is annoying for me as I've started using a pretty big library for an online payment system. Running those unit tests means constantly creating test accounts on that platform and having to delete them again. Every single tine Jenkins runs.

与排除每个类中的每个类相比,仅排除文件夹要容易得多.

And it would be far simpler to just have the folders excluded than having to exclude every single one of the classes.

推荐答案

要通过更改Jenkins JaCoCo插件配置来排除整个目录,您需要在排除"字段中添加一个条目.

To exclude entire directories by changing the Jenkins JaCoCo plugin configuration you would need to add an entry to the 'Exclusions' field.

例如,如果要排除名为"test"的任何目录下的任何文件,则应添加以下排除项:

For instance, if you want to exclude any files under any directory named 'test' you would add the following exclusion:

**/测试/**

请记住,如果要添加多个排除项,则必须用逗号分隔每个排除项,并且不能有空格(由于插件的错误).

Keep in mind that if you want to add multiple exclusions you have to separate each one by a comma and there can be no spaces (due to a bug with the plugin).

这是我的JaCoCo插件配置: JaCoCo插件配置示例

Here is my JaCoCo plugin configuration: Example JaCoCo Plugin Configuration

这篇关于如何让Jenkins从代码覆盖范围中排除整个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆