Windows Presentation Foundation (WPF) c# code coverage not coming in SQ though all the unit tests success

Windows Presentation Foundation (WPF) c# code not showing code coverage % in SQ dashboard though unit tests are success in Azure Devops pipelines. Here I have attached files (Run Code Analysis & Publish Quality Gate Result). Please suggest us to get code coverage % in Sonarqube dashboard for successful unit tests.
11_VsTest - testAssemblies.txt (350.0 KB)
Uploading: 12_Run Code Analysis.txt…
I have given below Prepare Analysis Configuration
sonar.inclusions=/*.cs,
sonar.inclusions=
/**/*.cs,
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)\TestResults*.trx,
sonar.verbose=true

Please suggest us to resolve this.

Thanks,
Upendar

Hey there.

It looks like the Step 12 logs didn’t upload all the way. Can you try again?

12_Run Code Analysis.txt (433.7 KB)
I uploaded it fully now. Please check.

I think I need to take care of the below 2 items.

  1. run code analysis should find exact .TRX file
  2. then it shouldn’t get this, analyzing coverage after aggregate found ‘0’ coverage files. The total number of file count statistics is ‘0’.

Please suggest me to resolve these and get code coverage.

Hi Colin, Could you please help to resolve this issue. thanks

Hi Colin/Team,

Now I’m able to find .trx file like below.
"Code coverage command line tool: I:\VS2019\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe
Fetching code coverage report information from TFS…
Attempting to locate a test results (.trx) file…
Looking for TRX files in: F:\tfs_work\6110\TestResults, F:\tfs_work\6110\s\TestResults
The following test results files were found: F:\tfs_work\6110\s\TestResults\TFSBuild_LOUSSPWTP1135_2021-12-07_06_40_02.trx
Absolute path to coverage file:

F:\tfs_work\6110\s\TestResults\TFSBuild_LOUSSPWTP1135_2021-12-07_06_40_02\In\LOUSSPWTP1135\TFSBuild_LOUSSPWTP1135_2021-12-07.06_39_50.coverage
The following code coverage attachments were found from the trx files: F:\tfs_work\6110\s\TestResults\TFSBuild_LOUSSPWTP1135_2021-12-07_06_40_02\In\LOUSSPWTP1135\TFSBuild_LOUSSPWTP1135_2021-12-07.06_39_50.coverage"
But still getting same like earlier as
“Adding this code coverage report to the cache for later reuse: F:\tfs_work\6110.\s\TestResults\TFSBuild_LOUSSPWTP1135_2021-12-07_06_40_02\In\LOUSSPWTP1135\TFSBuild_LOUSSPWTP1135_2021-12-07.06_39_50.coveragexml
Analyzing coverage after aggregate found ‘0’ coverage files.
The total number of file count statistics is ‘0’.”

I understood as, statistics count shouldn’t be ‘0’. Need to find way to get the some values.

Thanks,Upendar

We have targeted the proper Test path in VSTest task, which allowed to get the coverage in the pipeline. thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.