当前位置: 首页 > 知识库问答 >
问题:

在SonarQube中导入SoapUI JUnit结果

翟善
2023-03-14

我使用Sonarqube:Version7.0(Build36138)-LGPL V3-Community。

然后,我使用这个变量sonar.junit.ReportPaths将测试执行报告导入到SonarQube中。

但是,当我用Sonar步骤a结束运行构建时,Sonar analyser没有获取test-xxx.xml文件(sonar-maven-plugin:3.4.0.905:Sonar):

(.../maven-3.5/bin/mvn-dsonar.login=token-dsonar.junit.reportpaths=target/report-dsonar.host.url=http://host:9000 sonar:sonar)

我附上一段声纳分析仪日志

[INFO] --- jacoco-maven-plugin:0.8.0:prepare-agent (prepare-it-agent) @ edp-xxx-dev ---
[INFO] jacoco.agent.it.arg set to -javaagent:/var/data/jenkins/.m2/repository/org/jacoco/org.jacoco.agent/0.8.0/org.jacoco.agent-0.8.0-runtime.jar=destfile=/var/data/jenkins/workspace/xxx/target/jacoco-it.exec,append=true
[INFO] 
[INFO] --- maven-failsafe-plugin:2.20.1:integration-test (integration-test-failsafe) @ edp-xxx-dev ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-failsafe-plugin:2.20.1:verify (verify-failsafe) @ edp-xxx-dev ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.575 s
[INFO] Finished at: 2018-02-20T16:07:54+01:00
[INFO] Final Memory: 29M/294M
[INFO] ------------------------------------------------------------------------
[EDP-xxx-DEV] $ /var/data/jenkins/maven-3.5/bin/mvn -Dsonar.login=token -Dsonar.junit.reportPaths=target/report -Dsonar.host.url=http://host:9000 sonar:sonar
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for fr.yyy:edp-xxx-dev:pom:0.0.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-failsafe-plugin is missing. @ line 75, column 15
[WARNING] 'build.plugins.plugin.version' for org.jacoco:jacoco-maven-plugin is missing. @ line 105, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building edp-xxx-dev 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO] 

[INFO] --- sonar-maven-plugin:3.4.0.905:sonar (default-cli) @ edp-xxx-dev ---
[INFO] User cache: /var/data/jenkins/.sonar/cache
[INFO] SonarQube version: 7.0.0
[INFO] Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
[INFO] Publish mode
[INFO] Load global settings
[INFO] Load global settings (done) | time=223ms
[INFO] Server id: AWFlfLYJl4_5JAEp_gm4
[INFO] User cache: /var/data/jenkins/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=102ms
[INFO] Load/download plugins
[INFO] Load/download plugins (done) | time=18ms
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=83ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=56ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=1565ms
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=83ms
[WARNING] SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
[INFO] Project key: fr.yyy:edp-xxx-dev
[INFO] -------------  Scan edp-xxx-dev
[INFO] Load server rules
[INFO] Load server rules (done) | time=685ms
[INFO] Base dir: /var/data/jenkins/workspace/[DIR]/[SUB_DIR]/EDP-xxx-DEV
[INFO] Working dir: /var/data/jenkins/workspace/[DIR]/[SUB_DIR]/EDP-xxx-DEV/target/sonar
[INFO] Source paths: pom.xml
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] 1 file indexed
[INFO] Quality profile for xml: Sonar way
[INFO] Sensor SonarJavaXmlFileSensor [java]
[INFO] 1 source files to be analyzed
[INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=776ms
[INFO] Sensor XML Sensor [xml]
[INFO] 1/1 source files have been analyzed
[INFO] Sensor XML Sensor [xml] (done) | time=243ms
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=20ms
[INFO] Sensor CPD Block Indexer
[INFO] Sensor CPD Block Indexer (done) | time=0ms
[INFO] No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
[INFO] Calculating CPD for 0 files
[INFO] CPD calculation finished
[INFO] Analysis report generated in 181ms, dir size=36 KB
[INFO] Analysis reports compressed in 21ms, zip size=10 KB
[INFO] Analysis report uploaded in 32ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://host:9000/dashboard/index/fr.yyy:edp-xxx-dev
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://host:9000/api/ce/task?id=AWGzwew1O8d_lgjIaxfY
[INFO] Task total time: 6.899 s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.558 s
[INFO] Finished at: 2018-02-20T16:08:06+01:00
[INFO] Final Memory: 23M/336M
[INFO] ------------------------------------------------------------------------

共有1个答案

锺星洲
2023-03-14

只有当模块中的类名与报告中的测试对应时,才会导入使用sonar.junit.ReportPaths指定的报告中的测试结果。

因此,如果报告中没有对应于测试的类,那么SonarQube中将不会显示任何内容(此外,您希望SonarQube准确地显示什么?)。

 类似资料:
  • 我已经安装了Sonarqube5.1.2和Checkstyle插件2.3。 我已经尝试导出一个现有的预装规则集,并尝试用其他名称导入它。但这会导致同样的失败。 这也是一个bug吗?

  • 语境 在一个使用karma和jasmine进行单元测试的Angular5项目中,我使用karma-sonarqube-unit-reporter为我的单元测试生成这个报告文件。 但是当我将它导入到Sonarqube(V6.7)(通过Jenkins)中时,我会得到以下结果 (此属性重要吗?)

  • 我有一个多模块Maven项目,其中覆盖报告位于覆盖Java类之外的另一个模块中。将非空xml覆盖报告(带有覆盖信息)导入Sonarqube是成功的,但显示覆盖范围为0。 复制步骤: 签出以下github项目,并使用构建它。之后,存在一个聚合的xml报告,该报告位于中。您可以在其中以及相应的html-Report中看到覆盖率数据。 编辑:插件“JaCoco xml report importer”已

  • 设置/背景: 我工作的产品主要包含500kLOC(Java和Javascript)。自Fortify 3. x/4. x以来,我们已经运行了大约十年的Fortify静态分析。我们使用SSC来查看和审核分析结果。这样,除了安全线索之外,团队中可能感兴趣的其他人也可以获得结果。 随着代码的发布,Fortify版本也会定期升级,度量标准也会迁移到新版本。Fortify平台和升级由一个单独的团队管理。我们

  • 我刚开始在R中使用网状包,我仍然在解决一些问题。特别是,导入matplotlib的过程并不顺利。我尝试了两种不同的方法,每种方法都有不同的错误消息。 首先,在RStudio的交互式shell中使用repl_python: 打开的REPL-Python shell似乎拥有正确的版本和所有内容,但当我尝试导入matplotlib时。pyplot,我看到了以下内容: /lib/x86_64-linux-

  • 通过Three.js模型数据导入导出过程的学习,可以让你对Threejs解析加载外部模型的过程更为了解。 Threejs导出模型信息 你可以通过下面代码导出模型的各类信息,然后在浏览器控制台打印出来模型数据,然后复制浏览器控制台模型数据粘贴到json文件中,最后可以尝试加载解析这些Threejs导出的json文件。之所以这么做,是为了让你理解其它三维软件,比如3dmax、blender软件导出的三