I have setup SonarCloud with my C# project, and it works fine, I can see Code Coverage
and Unit Tests
but these Unit Tests
are only static number of my tests i.e. 13
when I entered into this I cannot see the tests structure instead No results
. I checked logs from SonarCloud Analyze
and it does not contain any errors. All my tests are in XUnit
and all results are stored in XUnitResults.xml
file that is provided via sonar.cs.xunit.reportsPaths=$(Build.SourcesDirectory)/**/XUnitResults.xml
- this line consumes all XUnitResults.xml
.
INFO: Sensor C# Tests Coverage Report Import [csharp] (done) | time=699ms
INFO: Sensor C# Unit Test Results Import [csharp]
INFO: Parsing the XUnit Test Results file 'D:\a\1\s\{MY_PROJECT_PATH}\XUnitResults.xml'.
INFO: Parsing the XUnit Test Results file 'D:\a\1\s\{MY_PROJECT_PATH}\XUnitResults.xml'.
INFO: Sensor C# Unit Test Results Import [csharp] (done) | time=41ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=1ms
Additionally for the coverage I do have a line sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/**/Coverage.opencover.xml
which is also consumed fine.
INFO: Sensor C# [csharp] (done) | time=720ms
INFO: Sensor C# Tests Coverage Report Import [csharp]
INFO: Parsing the OpenCover report D:\a\1\s\TestResults\Coverage.opencover.xml
INFO: Adding this code coverage report to the cache for later reuse: D:\a\1\s\TestResults\Coverage.opencover.xml
I tried to use .trx
and unfortunately it does not work as here, the only result was a static number of tests.