Must-share information (formatted with Markdown):
-
which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube 7.9, Azure Devops Server 2019, .NET 4.7.2 -
what are you trying to achieve
I have a project written in VBnet, but tests written in C#. Im trying to use the Azure Devops Server sonar tasks to analyze and report code coverage to a sonar server. -
what have you tried so far to achieve this
I have been at this for several days now.
I run tasks in the following order
- SonarQubePrepare
- VSBuild
- VSTest
- SonarQubeAnalyze
- SonarQubePublish
I have checked the checkbox “code coverage” in the VSTest-task
When reviewing the logs i find the following.
During the VSTest phase two files are created a trx
file and seperate coverage
file.
Snippet from the logs
Results File: D:\BuildAgents\Agent1\_work\8\s\TestResults\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20.trx
Attachments:
D:\BuildAgents\Agent1\_work\8\s\TestResults\3884bd45-6d21-4008-be94-0dcd7906ada9\SYSTEM_E75LWNWS1286V 2020-04-14 17_33_14.coverage
But during the SonarQubeAnalyzis task, i can see that it locates the trx
file, and from that file it derives another coverage file and not the i posted above.
This file is located in a in
folder (some sort of temp folder).
17:33:29.4 Attempting to locate a test results (.trx) file...
17:33:29.51 Looking for TRX files in: D:\BuildAgents\Agent1\_work\8\TestResults, D:\BuildAgents\Agent1\_work\8\s\TestResults
17:33:29.51 The following test results files were found: D:\BuildAgents\Agent1\_work\8\s\TestResults\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20.trx
17:33:29.619 Absolute path to coverage file: D:\BuildAgents\Agent1\_work\8\s\TestResults\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20\In\E75LWNWS1286V\SYSTEM_E75LWNWS1286V 2020-04-14 17_33_14.coverage
17:33:29.619 The following code coverage attachments were found from the trx files: D:\BuildAgents\Agent1\_work\8\s\TestResults\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20\In\E75LWNWS1286V\SYSTEM_E75LWNWS1286V 2020-04-14 17_33_14.coverage
17:33:29.619 Not using the fallback mechanism to detect binary coverage files.
17:33:29.635 Executing file D:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Args: analyze /output:D:\BuildAgents\Agent1\_work\8\s\TestResults\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20\In\E75LWNWS1286V\SYSTEM_E75LWNWS1286V 2020-04-14 17_33_14.coveragexml D:\BuildAgents\Agent1\_work\8\s\TestResults\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20\In\E75LWNWS1286V\SYSTEM_E75LWNWS1286V 2020-04-14 17_33_14.coverage
Working directory: D:\BuildAgents\Agent1\_work\8\s\TestResults\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20\In\E75LWNWS1286V
Timeout (ms):60000
Process id: 9604
17:33:29.681 Process returned exit code 0
TLDR
// Generated in test step
D:\BuildAgents\Agent1\_work\8\s\TestResults\3884bd45-6d21-4008-be94-0dcd7906ada9\SYSTEM_E75LWNWS1286V 2020-04-14 17_33_14.coverage
// Derived from the trx file
D:\BuildAgents\Agent1\_work\8\s\TestResults\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20\In\E75LWNWS1286V\SYSTEM_E75LWNWS1286V 2020-04-14 17_33_14.coverag
The settings that SonarQubeAnalyzer is running are the following
sonar.cs.vstest.reportsPaths=D:\\BuildAgents\\Agent1\\_work\\8\\s\\TestResults\\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20.trx
sonar.cs.vscoveragexml.reportsPaths=D:\\BuildAgents\\Agent1\\_work\\8\\s\\TestResults\\E75LWNWS1286V$_E75LWNWS1286V_2020-04-14_17_33_20\\In\\E75LWNWS1286V\\SYSTEM_E75LWNWS1286V 2020-04-14 17_33_14.coveragexml
sonar.host.url=********
sonar.projectKey=********
sonar.projectName=*********
sonar.projectVersion=1.0
sonar.pullrequest.key=**********
sonar.pullrequest.base=master
sonar.pullrequest.branch=feature/code-coverage
sonar.pullrequest.provider=vsts
sonar.pullrequest.vsts.instanceUrl=***********
sonar.pullrequest.vsts.project=***********
sonar.pullrequest.vsts.repository=**********
sonar.scanner.metadataFilePath=D:\\BuildAgents\\Agent1\\_work\\_temp\\sonar\\20200414.21\\90676aad-b831-becc-3fd6-d858b0a949c2\\report-task.txt
sonar.visualstudio.enable=false
I have not explicitly configured anything except for sonar.logging=verbose
But according to the settings, sonar thinks this is a C# project, and not a VB project.
The analysis finishes and i have 0% coverage
So my questions are the following:
Why the trxfile?
Why do i have two coverage files?
Why is SonarQube only using the one derived from the trx file.
Why does it think it is only a C# project when 90% of the project code is VBnet
Why no coverage?