1
votes

I use SonarQube: Version 7.0 (build 36138)-LGPL v3-Community.

I would like to import the results of SoapUI tests suites executions in SonarQube as explained on this page:

(https://docs.sonarqube.org/pages/viewpage.action?pageId=1442166)

I run the SoapUI tests and have results generated in JUnit xml format (Test-xxx.xml). I

I then use this variable sonar.junit.reportPaths in order to import tests execution report into SonarQube.

But when I run my build with Sonar step a end, the Test-xxx.xml file is not taken by Sonar analyser (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)

Have I forget any configuration?

I append a snippet of Sonar Analyser log

[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
Anything relevant-seeming in your analysis log? If so, please edit the question to include it. - G. Ann - SonarSource Team
Sonar analyser log snippet added - Wognin
Any idea from SonarQube ? Is there any more complete tutorial or guide on this point ? I think that the problem is about the absence of source corresponding this test result (as it's generated from an external tool : SoapUI) - Wognin

1 Answers

0
votes

The test results in the report you specify with sonar.junit.reportPaths will be imported only if there is a class name in your module corresponding to that test in the report.

Therefore if no class correspond to the test in the report nothing will show up in SonarQube (moreover, what would you expect SonarQube to show exactly ?).