gpt4 book ai didi

sonarqube - JaCoCo-SonarQube-没有有关每次测试覆盖率的信息

转载 作者:行者123 更新时间:2023-12-03 12:20:56 26 4
gpt4 key购买 nike

我正在使用JaCoCo进行代码覆盖。单元测试报告是使用junit创建的,并且已正确导入,因此可以正确显示单元测试信息。
问题是,我收到错误消息:
没有有关每次测试的覆盖率的信息。 ,代码覆盖率显示单元测试,集成测试和总体覆盖率的值0%。
我检查了sonar-project.properties中的所有必需信息,例如二进制文件,src,测试等。

我正在使用:
-SonarQube 4.5.1
-SonarRunner 2.4
-MySQL
-junit 4.1.1
-雅各布0.7.2

jacoco.exec位于项目基本目录中的文件/ target中。

接下来,您可以看到sonar-project.properties:
从我的 Angular 来看,所有必要的路径都已正确设置。 (即二进制,src,测试)

Comma-separated paths to directories with sources (required)
sonar.sources=src

compiled code
sonar.java.binaries=class

source code of unit tests
sonar.tests=test/src

Comma-separated paths to files with third-party libraries (JAR files in the case of Java)
sonar.java.libraries=jar

Language
sonar.language=java

Encoding of the source files
sonar.sourceEncoding=UTF-8

Additional parameters
sonar.my.property=value

Set Project Base
sonar.projectBaseDir=C:/snapshots/steffen_latest/software/java

Tells SonarQube to reuse existing reports for unit tests execution and coverage reports
sonar.dynamicAnalysis=reuseReports

JUnit path
sonar.surefire.reportsPath=test/report/junit

Tells SonarQube where the unit tests execution reports are
sonar.junit.reportsPath=test/report/junit

Tells SonarQube that the code coverage tool by unit tests is JaCoCo
sonar.java.coveragePlugin=jacoco

Import JaCoCo code coverage report.
Tells SonarQube where the unit tests code coverage report is
Unit Tests Coverage
sonar.jacoco.reportPath=target/jacoco.exec

Tells SonarQube where the integration tests code coverage report is
sonar.jacoco.itReportPath=target/it-jacoco.exec

这是来自sonar-runner的日志文件:
13:56:05.883 INFO  - Sensor SurefireSensor...
13:56:05.883 INFO - parsing C:\work\snapshots\steffen_latest\software\java\test\report\junit
13:56:06.149 INFO - Sensor SurefireSensor done: 266 ms
13:56:06.149 INFO - Sensor JaCoCoItSensor...
13:56:06.195 INFO - Analysing C:\work\snapshots\steffen_latest\software\java\target\it-jacoco.exec
13:56:06.726 INFO - **No information about coverage per test**.
13:56:06.726 INFO - Sensor JaCoCoItSensor done: 577 ms
13:56:06.726 INFO - Sensor JaCoCoOverallSensor...
13:56:06.851 INFO - Analysing C:\work\snapshots\steffen_latest\software\java\.sonar\jacoco-overall.exec
13:56:07.178 INFO - **No information about coverage per test**.
13:56:07.178 INFO - Sensor JaCoCoOverallSensor done: 452 ms
13:56:07.178 INFO - Sensor JaCoCoSensor...
13:56:07.209 INFO - Analysing C:\work\snapshots\steffen_latest\or_base\software\java\target\jacoco.exec
13:56:07.521 INFO - **No information about coverage per test**.
13:56:07.521 INFO - Sensor JaCoCoSensor done: 343 ms
13:56:07.521 INFO - Sensor CPD Sensor (wrapped)...
13:56:07.521 INFO - JavaCpdEngine is used for java
13:56:07.521 INFO - Cross-project analysis disabled
13:56:09.019 INFO - Sensor CPD Sensor (wrapped) done: 1498 ms
13:56:09.144 INFO - Execute decorators...
13:56:16.166 INFO - Store results in database

谁能给我一个建议,可能是什么问题?
既然不知道是什么问题
几天以来,我一直在研究这个问题,我真的不知道该怎么办。

先感谢您。

最佳答案

您是否尝试过使用prepare-agent

mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install

另外,如果覆盖率持续显示0%,则可能需要遵循 this advice:

If your project already uses the argLine to configure the surefire-maven-plugin, be sure that argLine defined as a property, rather than as part of the plugin configuration."

关于sonarqube - JaCoCo-SonarQube-没有有关每次测试覆盖率的信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27297071/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com