cobertura插件应用过程

代码覆盖率 只能覆盖字段声明,构造函数或方法体。

引用:https://blog.csdn.net/bingleihenshang/article/details/102885020

1.引入插件(配合maven使用)

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>
            </plugin>

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <formats>
                        <format>html</format>
                        <format>xml</format>
                    </formats>
                    <check/>
                </configuration>
                <!--executions 在构建生命周期中执行一组目标的配置,每个目标有不同配置-->
                <executions>
                    <execution>
                        <!--phase绑定了目标的构建生命周期阶段,如果省略,目标会被绑定到源数据里配置的默认阶段-->
                        <phase>package</phase>
                        <!-- 配置的执行目标 -->
                        <goals>
                            <goal>clean</goal>
                            <goal>cobertura</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

2.应用在程序中

跑完测试后会出现如下图:

导出和查看生成的html文件

找到保存的目录文件,打开index.html


 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值