Must-share information (formatted with Markdown):
-
which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
Azure SonarQubePrepare/Plugin 4.8.0
SonarQube Community Edition Version 8.0 (build 29455) -
what are you trying to achieve
Hello, I am trying to get dotcover code coverage and nunit tests to be part of the sonarqube analysis on an azure devops pipeline. -
what have you tried so far to achieve this
I have run tests and code coverage using a powershell script.
The cobertura converted dotCover results are stored in cobertuta/coverage.xml relative to rootfolder.
Nunit files are generated as *nunit.dll.xml in different folders.
I tried adding properties to the task in azure
- task: SonarQubePrepare@4
inputs:
SonarQube: '****'
scannerMode: 'MSBuild'
projectKey: '***'
projectName: '***'
extraProperties: |
sonar.exclusions=**/*.xml
sonar.cobertura.reportPath=cobertura/coverage.xml
sonar.cs.nunit.reportsPaths=**/*nunit.dll.xml
I also tried adding a sonar-project.properties file in the root folder of the repository
sonar.exclusions=**/*.xml
sonar.cobertura.reportPath=cobertura/coverage.xml
sonar.cs.nunit.reportsPaths=**/*nunit.dll.xml
And I tried setting the same values on the sonarqube server in the project. Tried all at the same time and one by one. But when I run the task it always says no unit tests found and no code coverage found. I also tried adding the cobertura report to the temp directory on the agent but same issue.
2020-01-17T09:52:28.4956920Z ##[section]Starting: SonarQubeAnalyze
2020-01-17T09:52:28.5163227Z ==============================================================================
2020-01-17T09:52:28.5163313Z Task : Run Code Analysis
2020-01-17T09:52:28.5163356Z Description : Run scanner and upload the results to the SonarQube server.
2020-01-17T09:52:28.5163403Z Version : 4.8.0
2020-01-17T09:52:28.5163439Z Author : sonarsource
2020-01-17T09:52:28.5163492Z Help : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.
[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2020-01-17T09:52:28.5163848Z ==============================================================================
2020-01-17T09:52:29.1371027Z [command]E:\agent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
2020-01-17T09:52:30.1034460Z SonarScanner for MSBuild 4.7.1
2020-01-17T09:52:30.1035600Z Using the .NET Framework version of the Scanner for MSBuild
2020-01-17T09:52:30.1414338Z Post-processing started.
2020-01-17T09:52:31.0973059Z 10:52:31.096 Fetching code coverage report information from TFS...
2020-01-17T09:52:31.0988253Z 10:52:31.098 Attempting to locate a test results (.trx) file...
2020-01-17T09:52:31.2757152Z 10:52:31.275 Looking for TRX files in: E:\agent\_work\21\TestResults
2020-01-17T09:52:31.2760808Z 10:52:31.275 No test results files found
2020-01-17T09:52:31.4606148Z 10:52:31.46 Did not find any binary coverage files in the expected location.
2020-01-17T09:52:31.4616521Z 10:52:31.461 Falling back on locating coverage files in the agent temp directory.
2020-01-17T09:52:31.4625976Z 10:52:31.462 Searching for coverage files in E:\agent\_work\_temp
2020-01-17T09:52:31.4635987Z 10:52:31.463 No coverage files found in the agent temp directory.
2020-01-17T09:52:33.9421742Z WARNING: File 'E:\agent\_work\21\s\XXXX' does not exist.
2020-01-17T09:52:34.1390048Z Calling the SonarQube Scanner...
2020-01-17T09:52:34.4608295Z INFO: Scanner configuration file: E:\agent\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\sonar-scanner-4.1.0.1829\bin\..\conf\sonar-scanner.properties
2020-01-17T09:52:34.4654950Z INFO: Project root configuration file: E:\agent\_work\21\.sonarqube\out\sonar-project.properties
2020-01-17T09:52:34.6060756Z INFO: SonarQube Scanner 4.1.0.1829
2020-01-17T09:52:34.6061269Z INFO: Java 1.8.0_231 Oracle Corporation (64-bit)
2020-01-17T09:52:34.6061491Z INFO: Windows 10 10.0 amd64
2020-01-17T09:52:35.5222408Z INFO: User cache: C:\Users\admin\.sonar\cache
2020-01-17T09:52:36.2219211Z INFO: SonarQube server 8.0.0
2020-01-17T09:52:36.2233491Z INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
2020-01-17T09:52:36.5969186Z WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
2020-01-17T09:52:36.6935444Z INFO: Load global settings
2020-01-17T09:52:37.4791816Z INFO: Load global settings (done) | time=785ms
Any idea what I am missing?
Can I log the properties of the sonarqube run somehow?