- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在用:
SONAR v.3.2(它有jacoco)
Maven 3.0.4
遵循“http://johndobie.blogspot.in/2012/05/easy-unit-and-integration-code-coverage.html#comment-form”以获得单元和 IT 测试的单独代码覆盖率。但 IT 测试覆盖率显示为 0%。
它生成单独的 jacoco-unit.exec (44kb) 和 jacoco-it.exec (14kb),但覆盖率仅显示在 SONAR 上的单元测试中。
日志显示为:
[INFO] [13:10:23.515] Sensor SquidSensor done: 9437 ms
[INFO] [13:10:23.515] Sensor JaCoCoSensor...
[INFO] [13:10:23.578] Analysing ...\target\coverage-reports\jacoco-unit.exec
[INFO] [13:10:30.390] Sensor JaCoCoSensor done: 6875 ms
[INFO] [13:10:30.390] Sensor JaCoCoItSensor...
[INFO] [13:10:30.390] Analysing ...\target\coverage-reports\jacoco-it.exec
[INFO] [13:10:30.469] Sensor JaCoCoItSensor done: 79 ms
[INFO] [13:10:30.484] Sensor SurefireSensor...
[INFO] [13:10:30.484] parsing ...\target\surefire-reports
[INFO] [13:10:30.828] Sensor SurefireSensor done: 344 ms
[INFO] [13:10:30.828] Sensor CpdSensor...
[INFO] [13:10:30.828] SonarEngine is used
[INFO] [13:10:30.844] Cross-project analysis disabled
[INFO] [13:10:32.312] Sensor CpdSensor done: 1484 ms
[INFO] [13:10:32.312] Sensor CheckstyleSensor...
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.csr.lts</groupId>
<artifactId>lts-webapp</artifactId>
<packaging>war</packaging>
<name>LTS Webapp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>com.csr</groupId>
<artifactId>lts</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<properties>
<coverage.reports.dir>${basedir}/target/coverage-reports</coverage.reports.dir>
<sonar.jacoco.reportPath>${coverage.reports.dir}/jacoco-unit.exec</sonar.jacoco.reportPath>
<sonar.jacoco.itReportPath>${coverage.reports.dir}/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.jar>${basedir}/lib/org.jacoco.agent-0.5.10.201208310627-runtime.jar</sonar.jacoco.jar>
</properties>
<build>
<finalName>lts</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
<configuration>
<argLine>
-javaagent:${sonar.jacoco.jar}=destfile=${sonar.jacoco.reportPath},append=false,includes=com.*
</argLine>
<includes>
<include>**/*Test.java</include>
<include>**/Test*.java</include>
</includes>
<excludes>
<exclude>**/IT*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12.3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<argLine>
-javaagent:${sonar.jacoco.jar}=destfile=${sonar.jacoco.itReportPath},append=false,includes=com.*
</argLine>
<includes>
<include>**/IT*.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
最佳答案
您可以在此处查看我们的示例项目:https://github.com/SonarSource/sonar-examples/tree/master/projects/languages/java/code-coverage/combined%20ut-it
感谢 JaCoCo,您会发现同时报告了单元测试和集成测试覆盖率的项目示例。
关于integration-testing - 在 SONAR 中使用 Jacoco 的 IT 测试覆盖率为 0%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12425564/
在为jhipster配置以下docker容器之后,除了声纳,其他一切都很好: docker run --name jhipster -w / home / jhipster / app -v〜/ jh
最新的 3.3 sonar-maven-plugin 和 5.6 LTS 作为网络服务器。 使用 mvn sonar:sonar 运行 Sonar 分析( Scanner for Maven ) 忽略
我有一个 cobertura.ser 文件,是在集成测试和系统测试时生成的。现在我想将我的覆盖范围导入 Sonar 服务器。 如何实现这一点,以便在执行 mvn sonar:sonar 时覆盖范围应考
场景:我们有一个 Jenkins maven 构建,它在父 pom 上执行 Sonar : Sonar 。我希望此构建的所有模块都显示为单个 Sonar 项目。目前,我们只有一个带有子模块的 Sona
我有一个看起来像这样的 build.xml 文件: 当我运行文件时,我得到: The prefix "sonar" for element "sonar:sonar" is
我尝试使用标准 maven sonar:sonar 目标在 Jenkins 上使用 java 项目运行 Sonar 分析,并使用后步骤 >> 执行 SonarQube 扫描仪。我使用的maven目标是
我想知道 sonar.projectKey、sonar.projectName 和 sonar.projectVersion 是否有任何标准。 我正在 git 环境中工作,需要对同一 git 存储库的
我有一个很大的困惑,当我们有 Sonar 服务器时 Sonar 扫描仪有什么用?当我使用 soarqube 服务器分析一个项目时,它进行了分析并且运行良好。我仍然很困惑为什么我们也需要扫描仪。 与ec
Sonar 与 jenkins 一起正常运行了 6 个月,没有出现任何故障。从上周开始,我看到一些 jenkins 作业出现以下错误,导致作业失败。 [ERROR] Failed to execute
鉴于相同的代码和具有相同规则的相同 SonarQube 服务器,我在使用 mvn sonar:sonar 与 sonar-scanner 扫描时发现的错误和漏洞数量截然不同。 code> CLI 和
我正在编写一个 Sonarqube Java 自定义规则,但在我尝试分析我的代码时一直出现此错误: "SonarQube is unable to analyze file 'File Path' o
我正在尝试将 SonarQube 与 Azure Devops 集成。我已在 SonarQube 管理员中完成配置(管理 > 配置 > 常规设置 > ALM 集成,选择 Azure DevOps 选项
我正在尝试将 SonarQube 与 Azure Devops 集成。我已在 SonarQube 管理员中完成配置(管理 > 配置 > 常规设置 > ALM 集成,选择 Azure DevOps 选项
我想与Jenkins一起针对Maven 2项目启动SonarQube分析。我首先在构建配置中使用了目标sonar:sonar。 但是我刚刚找到了Jenkins的SonarQube插件。为什么要使用它?
将Sonar 4.2(正常运行)与gradle(已测试版本1.11和1.12)一起使用,配置了sonar-runner: allprojects { if (rootProject == pr
我将 Sonar 与 Jenkins 一起使用以进行持续集成和代码分析。我learned该 Sonar 默认包括 Checkstyle、FindBugs、JaCoCo、PMD ,所以我们不需要配置项目
我们想在我们的项目中使用 SonarQube 和一些 CI 工具。 Sonar 服务器 url 在主 pom.xml 中配置。 项目中有几个团队成员。那么当一个团队成员在本地执行 sonar:sona
命令 mvn sonar:sonar 执行的 Maven 生命周期阶段是什么? 虽然我看到了在屏幕上运行的日志,但在非常高的水平上,我发现了测试、安装。 考虑下面的例子, 我有一个像下面这样的mave
我有几个 groovy/grails 项目,我正在使用 sonar-runner 来分析它们。他们工作得很好,直到今天我开始收到这个错误: ERROR: Error during Sonar runn
当我运行声纳时,我的代码覆盖率总是为 0。我使用的是三叶草。 pom.xml 文件中的条目下方 11 1.18.20 Hoxton.SR11
我是一名优秀的程序员,十分优秀!