jacoco

JaCoCo & Gradle - Filtering Options

ぃ、小莉子 提交于 2019-12-05 18:34:20
I'm currently using the Gradle plugin to run JaCoCo for code coverage repots. I wanted to specify in my build.gradle some filtering options; https://github.com/jacoco/jacoco/wiki/FilteringOptions I can see that this is possible from the Maven plugin; e.g. https://github.com/timezra/jacoco-scala-maven-plugin From the Gradle doco here there appears no clear way on how to do this. How can I set filtering options for JaCoCo when running as part of a build.gradle script? Gradle's JaCoCo plugin doesn't currently provide such filtering options. If you think it should, please file a feature request

Plugin with id 'org.sonarqube' not found

狂风中的少年 提交于 2019-12-05 18:09:34
问题 I am trying to implement sonar with gradle for code-coverage measure for my project. we are using gradle-4.0.1 and sonarqube-6.4 . when I run gradle sonarqube from command line I get this error- Plugin with id 'org.sonarqube' not found. I tried few code changes but no luck, please help. My build.gradle file is as below- buildscript { ext { springBootVersion = '1.5.4.RELEASE' } repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:$

Code coverage in maven build - Skipping JaCoCo execution due to missing classes directory

空扰寡人 提交于 2019-12-05 16:51:47
问题 I am able to get code coverage working fine if I have a single project but now I have a multi module project. My application is built in the api project and all my integration tests are running in a separate project which uses the artefact built as previous module. The build runs but I dont get a code coverage report, instead I get the info message: Skipping JaCoCo execution due to missing classes directory My coverage report file jacoco-it.exec is created but it seems like the jacoco plugin

SonarQube does not display detailed report per file for fully covered classes via Gradle

瘦欲@ 提交于 2019-12-05 10:17:44
I am running a Gradle build inside the IntelliJ Java IDE. The SonarQube runner Gradle plugin is used along with the JaCoCo Gradle plugin. Problem: I am getting the message No information about coverage per test. , ( not a duplicate of this post , see below) and the coverage appears in SonarQube, but only as an overall percentage, not a detailed report per file: Am I doing something wrong? Is it a bug in SonarQube maybe (as it was with Cobertura recently)? Here is my build.gradle: repositories { mavenCentral() } apply plugin: 'java' apply plugin: 'jacoco' apply plugin: 'sonar-runner'

测试工具 - IDEA - IDEA Code Coverage

故事扮演 提交于 2019-12-05 10:11:18
概述 使用 idea 自带的 code coverage 工具 背景 了解 白盒测试用例设计 和 测试覆盖率 之后, 大概就需要 实践 了 实践的话, 还是需要 工具 来检验效果 工具选取 选项 JaCoCo IDEA Code Coverage 结果 两个都想试试 先看看 IDEA CC, 这个比较简单 JaCoCo 感觉更加复杂 指标 使用的场景都更加复杂 先讲 IDEA Code Coverage 简单 Idea 自带, 集成方便 1. 准备 理论基础 白盒测试用例设计 测试覆盖率 环境 os win 10 ide idea 2018.2 组件 java jdk8 testng 6.14.3 maven 3.6.0 代码 maven architecture quickstart 其他 idea 插件 coverage 这个一定要有 有了, 一定要打开 idea 添加插件, 我就不讲了 testng 的配置文件 这个我也不细讲了 自动生成配置文件的插件, 我之前讲过 配置文件里一些主要的配置, 我也讲过 2. 触发 概述 通过 执行测试, 触发 Coverage 插件 步骤 执行测试 进入某个测试类 比如 maven 工程自带的 AppTest 类 执行测试 在 类 中右键 选择 'Run Apptest with Coverage' 当然, 执行方式有很多 方法 类

测试理论 - 代码覆盖率

本小妞迷上赌 提交于 2019-12-05 08:57:20
概述 整理一下我对 代码覆盖率 的认识 背景 理解了 白盒测试 用例设计 设计完了, 总需要一个 标准, 来评估用例的某些方面 这个可能, 是 覆盖率 提出的意义吧 至于这个是谁最先提出, 又是出于 什么目的, 现已无从考证 主要是我 懒得考证... 1. 回顾: 白盒测试用例设计思路 概述 回顾一下白盒测试用例的设计思路 思路 代码覆盖 分支覆盖 条件覆盖 分支条件覆盖 多重条件覆盖 ref 后面会有 2. 覆盖率 概述 简单介绍 覆盖率 覆盖率 作用 度量 测试用例 对 代码 测试程度 意义 找出那些地方没有测 重视没有覆盖的部分 重点是解释这些问题 为什么没有覆盖 能否覆盖 对于 测试质量, 没有任何的表述 是的, 覆盖率高, 未必就是 测试得好 计算方式 代码覆盖率 覆盖率 = 被测代码行数 / 代码总行数 当然还有其他的 覆盖率 那些怎么算的, 我目前还不清楚 3. 常见的 覆盖率 指标 概述 以 jacoco 的指标为例, 简单说明一下 jacoco 执行结果 概述 简单描述下 jacoco 执行结果 列 Element 被测的包 Missed Instructions & Cov 指令覆盖 Missed Branhes & Cov 分支覆盖 Missed & Cxty 圈复杂度 Missed & Lines 代码覆盖 Missed & Method 方法覆盖

How to ignore inner/nested classes with JaCoCo?

天大地大妈咪最大 提交于 2019-12-05 08:02:43
I'm trying to ignore some generated classes, and the classes get ignored fine. But if those classes have inner classes, those classes still get included, despite the parent class being excluded. This is my configuration: <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.9</version> <executions> <execution> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>report</id> <phase>prepare-package</phase> <goals> <goal>report</goal> </goals> <configuration> <excludes> <exclude>**/*DB.*</exclude> <exclude>**/*DTO.*</exclude> <

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_14f7ee5/Offline

让人想犯罪 __ 提交于 2019-12-05 07:43:28
I'm seeing the following error in my Android project after updating to Gradle Build Tools 2.1.3 and Gradle 2.14.1. It happens immediately when I run the application. How do I fix this? java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_14f7ee5/Offline; at com.ourapp.next.conversation.SomeList.SomeListViewModel.$jacocoInit(SomeListViewModel.java) at com.ourapp.next.conversation.SomeList.SomeListViewModel.(SomeListViewModel.java) at com.ourapp.next.conversation.SomeList.SomeListAdapterTest.(SomeListAdapterTest.java:26) at java.lang.reflect.Constructor.newInstance

如何使用Jacoco远程统计tomcat服务的代码覆盖率

泄露秘密 提交于 2019-12-05 04:02:24
如何使用Jacoco远程统计tomcat服务的覆盖率 在做软件开发的时候经常会遇到做各种测试,这里介绍一种本人遇到的:代码覆盖率测试, 这个测试非常实用,能发现许多无效的模块和代码。强烈推荐!!!!! 网上好多资料都不全,而且没有详细的配置流程 本文将简单介绍如何使用Jacoco生成远程tomcat服务的覆盖率报告。 (注:使用jacoco打开远程服务端口,有一定安全风险。) 软件安装 Ant Jacoco 远程Tomcat服务配置 1:sh shutdown.sh先关闭tomcat服务。 2:修改bin/catalina.sh中JAVA_OPTS的配置。 # -javaagent: 的后面跟jacoco的安装路径 # includes= 选项,选择你要覆盖率的服务 # port= 选项,选择你要打开的端口 # address= 选项,tomcat服务所在机器的ip地址(如果想在跟tomcat服务同一台机器上执行ant任务的话,需要改为127.0.0.1) JAVA_OPTS="-javaagent:/path/to/your/jacoco_0.6.4/lib/jacocoagent.jar=includes=com.baidu.*,output=tcpserver,port=8893,address=10.81.14.77" 3: sh startup

JaCoCo - exclude JSP from report

蓝咒 提交于 2019-12-05 03:41:40
In the Maven site reports generated by JaCoCo, I get quite bad coverage because all of my compiled JSPs are included (and they are long). I tried the following in reporting : <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <configuration> <exclude>target/classes/jsp/**/*.class</exclude> </configuration> </plugin> Another similar-looking configuration is in the build section of the POM for the prepare-package phase. That doesn’t stop the JSP classes from being included in the report. How to avoid that? That's quite easy. The clue is, that the exclude tag