Unit test result (angular) does not show on SonarQube Dashboard for Asp Core with Angular Application which is part of Visual Studio solution, but coverage results is fine. i.e. shown on sonar dashboard

SonarQube Version: 8.9

  • what are you trying to achieve
  1. As mentioned in subject, angular tests not counted as part of total counts, only dot net unit tests count only counted and shown on sonar dashboard
    – tried multiple options / suggestions provided over community but not succeeded, getting either below info or can’t be indexed twice. check inclusion/exclusion
             INFO: Imported test execution data for 0 files
             INFO: Test execution data ignored for XX unknown files

refer below screenshot, in which expected test count will be more than 127 i.e. it should include angular project test count also, but actually not.

  1. even when clicked on test count on sonarqube dashboard, which redirects to https://‘XXXXX’.com/sonarqube/component_measures?id=xxxx&metric=tests&view=list, which doesn’t show list of test files underneath test count?
  • what have you tried so far to achieve this
    Tried Options
  1. used both options Sonar Scanner with MSBuild and CLI with associated properties respectively, but same result.
      INFO: Imported test execution data for 0 files
      INFO: Test execution data ignored for XX unknown files
  1. included SonarQubePrepare@4 at only angular level, i.e. before angular build, and test later sonar analysis and sonar publish task, but same result as above, count shows as ‘-’

Note: But locally, with in VS / from terminal, npm run sonar working at angular project level, but solution level and in build pipeline not working.

do help us know in finding the cause of the above mentioned issues, it will be really helpful and appreciated. thanks in advance.

Project Folder Structure:

Sonar Properties: in Azure Devops Build Pipeline | YAML file

task: SonarQubePrepare@4
  displayName: 'prepare sonar qube analysis'
    SonarQube: 'sonarqube'
    scannerMode: 'MSBuild'  -- Tried even CLI, its related properties cliProjectKey, cofigemode=manual etc..
    projectKey: 'XXXX'
    projectName: 'XXXX'
    extraProperties: |
- task: SonarQubeAnalyze@4

- task: SonarQubePublish@4
    pollingTimeoutSec: '300'


module.exports = function (config) {
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    coverageReporter: {
      // specify a common output directory
      dir: '../coverage',
      reporters: [
        // reporters not supporting the `file` property
        { type: 'html', subdir: 'report-html' },
        { type: 'lcov', subdir: 'report-lcov' },
        // reporters supporting the `file` property, use `subdir` to directly
        // output them in the `dir` directory
        { type: 'cobertura', subdir: '.', file: 'cobertura.txt' },
        { type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' },
        { type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
    reporters: ['progress', 'kjhtml', 'junit', 'sonarqubeUnit'],
    junitReporter: {
      outputDir: '../junit'
    sonarQubeUnitReporter: {
      sonarQubeVersion: 'LATEST',
      outputFile: '../reports/sonar_report.xml',
      overrideTestDescription: true,
      testPaths: ['./src'],
      testFilePattern: '.spec.ts',
      useBrowserName: false
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['ChromeHeadless'],
    singleRun: false

Hello and sorry for the delay.

For the C# UTs, you provided both the coverage reports paths (sonar.cs.opencover.reportsPaths) and the test execution report path (sonar.cs.vstest.reportsPaths), and it works.

For JS, I see you provide sonar.testExecutionReportPaths as per instructions, however did you verify the file is in the correct place?

Could you please provide the verbose logs of SonarQubeAnalyze step?

To get these, please add sonar.verbose=true as extraProperties to SonarQubePrepare

1 Like

A post was split to a new topic: Problem importing TS UT report

Hi Suren b,

Was this issue resolved, if yes could you please let me how was it resolved?
I am also facing similar issue.

Hi @SRP. I’m afraid we don’t know if this issue was resolved or not.

Please create a new thread containing details about the problem you are having.