Unable to publish Unit Test results into SQ

Hi All,

We are currently unable to import VSTest results into SQ.
Ver used: 7.5

Steps followed in the build tasks:

  1. Have a Prepare Analysis task with the foll. properties:
    sonar.cs.vscoveragexml.reportsPaths=**/*.coveragexml
    /d:sonar.cs.xunit.reportsPaths="%CD%\XUnitResults.xml"

  2. MS Build task

  3. VSTest task -
    with code coverage enabled checked

  4. have a command line script task with foll.:
    packages\xunit.runner.console.2.1.0\tools\xunit.console.exe
    WrittenNotification.Services.UnitTest\bin\Release\net47\WrittenNotification.Services.UnitTest.dll -xml
    XUnitResults.xml

  5. run code analysis task

things verified:

  1. build succeedded
  2. verified the test results file was generated - XUnitResults.xml at the given location
  3. SQ shows number of tests run, but no other details.

The question here is, what should we see here:

We see No results displayed… what are we missing here? Thanks for your time.
Reference document that we used to set up our process:
https://docs.sonarqube.org/pages/viewpage.action?pageId=6389772#UnitTestExecutionResultsImport(C,VB.NET)-xUnit

welcome to the forum, @kiruthiga

  1. Commands used to analyze the project -->

  2. Log of the end analysis task
    run code analysis task - log.txt (19.3 KB)

Hope this helps…
We even tried the foll. command on the analyze task::

sonar.cs.vscoveragexml.reportsPaths=/*.coveragexml
sonar.cs.xunit.reportsPaths=
\TestResults*.trx

Even the above failed to produce any results to the SQ server. All that we see is 12 cases run and no other details.

Thanks for the help.

Hi,

From the screen shot, it looks like code coverage information is being imported correctly (i.e. coverage percentage, lines to cover, uncovered lines etc). You should be able to drill down from the Coverage measure to see the individual lines of code that are not covered e.g.

However, we don’t currently show the individual tests that were run, just the number. There is an open issue for this feature that you might want to watch/vote for.

1 Like

Perfect, thanks much for the timely response… Now i think i have a better idea of how this works… really appreciate your help…

1 Like