How do I get SonarCloud to report on nUnit test coverage rather than MS Test

How do I get SonarCloud to report on nUnit test coverage rather than MS Test? I am asking because currently we have two testing frameworks in the same repo. We are correcting by doing clean as you code, but this means that the two frameworks will be in there a while.

  • We are Using Bitbucket Cloud as our source code repository
  • CI system: Azure DevOps – We have a pipeline
  • We are using Microsoft Visual Studio 2019 Enterprise Edition to determine code coverage and execute the tests.
  • Language of the repository is C#
  • Only if the SonarCloud project is private
  • Steps to reproduce - 1. We set up Sonar Cloud
    2. Integrated with Azure Dev Opts
    3. Added the pipeline
    4. Included Visual Studio Test in the pipeline
    5. Set up the windows build build including Visual Studio 2019 Enterprise Edition
  • Potential workaround: None Found

Here our the configs for VS Test:




image

Resolution: In the prepare analysis part of the pipeline, under additional properties, we point to what reports we want I have just added the line “sonar.cs.nunit.reportsPaths=$(Agent.TempDirectory)/*.trx”

We followed this documentation [Coverage & Test Data] Generate Reports for C#, VB.net

This allowed us to collect code coverage data for nUnit.

2 Likes

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