gpt4 book ai didi

java - SonarQube 组件覆盖率详细信息与 JUnitTest 报告 : How to avoid resource not found warning?

转载 作者:行者123 更新时间:2023-11-30 03:03:00 25 4
gpt4 key购买 nike


我对 Sonar 还很陌生,但不幸的是,最近几天我无法在网上找到任何可以帮助我解决问题的信息。

我正在 Jenkins 服务器上运行 SonarRunner,并尝试插入 jUnit 报告,以便在 SonarQube 上项目的“覆盖范围”选项卡中查看一些内容。

问题似乎出在加载创建的 jUnit 报告上,因为错误消息指向 junit 框架:

INFO: SonarQube Server 5.3
13:39:28.405 INFO - Load global repositories
13:39:28.608 INFO - Load global repositories (done) | time=203ms
13:39:28.639 INFO - User cache: C:\Windows\system32\config\systemprofile\.sonar\cache
13:39:28.890 INFO - Load plugins index
13:39:28.890 INFO - Load plugins index (done) | time=0ms
13:39:29.202 INFO - Process project properties
13:39:29.249 INFO - Load project repositories
13:39:29.339 INFO - Load project repositories (done) | time=90ms
13:39:29.339 INFO - Apply project exclusions
13:39:29.444 INFO - Load quality profiles
13:39:29.516 INFO - Load quality profiles (done) | time=72ms
13:39:29.519 INFO - Load active rules
13:39:29.766 INFO - Load active rules (done) | time=247ms
13:39:29.771 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
13:39:29.771 INFO - Publish mode
13:39:29.771 INFO - ------------- Scan DatensatzManager
13:39:29.834 INFO - Load server rules
13:39:29.879 INFO - Load server rules (done) | time=45ms
13:39:29.911 INFO - Base dir: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src
13:39:29.911 INFO - Working dir: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\.sonar
13:39:29.911 INFO - Source paths: src
13:39:29.911 INFO - Test paths: test/com/carmeq/dia/dsm
13:39:29.911 INFO - Source encoding: windows-1252, default locale: de_DE
13:39:29.911 INFO - Index files
13:39:30.051 INFO - 162 files indexed
13:39:30.051 INFO - Quality profile for java: Sonar way
13:39:30.067 INFO - Sensor JavaSquidSensor
13:39:30.257 INFO - Configured Java source version: none
13:39:30.459 INFO - Java Main Files AST scan...
13:39:30.459 INFO - 144 source files to be analyzed
13:39:40.551 INFO - 99/144 files analyzed, current file: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\src\com\carmeq\dia\dsm\core\util\RawDatasetImportExport.java
13:39:50.558 INFO - 138/144 files analyzed, current file: D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\src\com\carmeq\dia\dsm\template_editor\logic\GUIActions.java
13:39:51.303 INFO - Java Main Files AST scan done: 20844 ms
13:39:51.303 INFO - 144/144 source files have been analyzed
13:39:51.303 WARN - Java bytecode has not been made available to the analyzer. The org.sonar.java.bytecode.visitor.DependenciesVisitor@1f6e340, org.sonar.java.checks.UnusedPrivateMethodCheck@1f9344b are disabled.
13:39:51.303 INFO - Java Test Files AST scan...
13:39:51.303 INFO - 18 source files to be analyzed
13:39:51.702 INFO - Java Test Files AST scan done: 399 ms
13:39:51.702 INFO - 18/18 source files have been analyzed
13:39:51.702 INFO - Sensor JavaSquidSensor (done) | time=21635ms
13:39:51.702 INFO - Sensor Lines Sensor
13:39:51.718 INFO - Sensor Lines Sensor (done) | time=16ms
13:39:51.718 INFO - Sensor QProfileSensor
13:39:51.718 INFO - Sensor QProfileSensor (done) | time=0ms
13:39:51.718 INFO - Sensor SurefireSensor
13:39:51.718 INFO - parsing D:\SonarTest\P2209-DatensatzManager\03-Umsetzung\06-Src\report
13:39:51.792 WARN - Resource not found: junit.framework.TestSuite
13:39:51.795 INFO - Sensor SurefireSensor (done) | time=77ms
13:39:51.795 INFO - Sensor SCM Sensor
13:39:51.795 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
13:39:51.795 INFO - Sensor SCM Sensor (done) | time=0ms
13:39:51.795 INFO - Sensor Code Colorizer Sensor
13:39:51.798 INFO - Sensor Code Colorizer Sensor (done) | time=3ms
13:39:51.798 INFO - Sensor CPD Sensor
13:39:51.798 INFO - JavaCpdEngine is used for java
13:39:52.234 INFO - Sensor CPD Sensor (done) | time=436ms
13:39:52.602 INFO - Analysis report generated in 352ms, dir size=3 MB
13:39:52.986 INFO - Analysis reports compressed in 384ms, zip size=1 MB
13:39:53.102 INFO - Analysis report uploaded in 116ms
13:39:53.102 INFO - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/my:project
13:39:53.102 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
13:39:53.102 INFO - More about the report processing at http://localhost:9000/api/ce/task?id=AVLvPnH_lmKETL1ow_XQ
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 25.530s
Final Memory: 6M/134M
INFO: ------------------------------------------------------------------------
Finished: SUCCESS

我完全不知道为什么 Sonar 正在搜索 junit.framework.TestSuite。有谁能帮我解决这个问题吗?

干杯!

最佳答案

请注意,surefire 传感器是关于单元测试的执行而不是覆盖范围。

要显示覆盖率,您需要提供可以使用 JaCoCo(推荐方式并包含在 sonar java 插件中)或使用 cobertura(需要安装 SonarQube 专用插件)生成的覆盖率报告。

surefire 传感器只会为您提供有关测试执行的信息。

关于java - SonarQube 组件覆盖率详细信息与 JUnitTest 报告 : How to avoid resource not found warning?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35458789/

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