使用JUnitTest报告的SonarQube组件覆盖率详细信息:如何避免资源未找到警告?

时间:2016-02-17 14:02:11

标签: java jenkins junit sonarqube


我对声纳很新,但不幸的是,我无法在网上找到任何可以帮助我解决问题的日子里的任何信息。

我在Jenkins服务器上运行SonarRunner并且我试图插入jUnit报告,以便在SonarQube上的项目的Coverage选项卡中查看一些内容。

问题似乎是在加载创建的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。有没有人可以帮我解决这个问题?

干杯!

1 个答案:

答案 0 :(得分:1)

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

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

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