Trouble with test data

I am trying to get the test execution report on sonarqube the coverage is successfull but not the unit test.
My sonarqube is running inside docker container. I have generated the test execution data using “mocha-sonarqube-reporter” and recived the data in xml format.
used nyc for coverage report.
the sonarqube cmd is as follows:

The sonar logs are as follows:

INFO: Scanner configuration file: /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/extensure-sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.5.0.2216
INFO: Java 1.8.0_272 AdoptOpenJDK (64-bit)
INFO: Linux 4.19.76-linuxkit amd64
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/extensure-sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.4.1
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
WARN: SonarScanner will require Java 11 to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=64ms
INFO: Server id: BF41A1F2-AXZHlvEOpdl3jkIdcHbq
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=35ms
INFO: Load/download plugins (done) | time=62ms
INFO: Process project properties
INFO: Process project properties (done) | time=7ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
INFO: Project key: Sonar_Extensure_test_11
INFO: Base dir: /var/jenkins_home/workspace/sonar_result_test
INFO: Working dir: /var/jenkins_home/workspace/sonar_result_test/.scannerwork
INFO: Load project settings for component key: 'Sonar_Extensure_test_11'
INFO: Load project settings for component key: 'Sonar_Extensure_test_11' (done) | time=19ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=52ms
INFO: Auto-configuring with CI 'Jenkins'
INFO: Load active rules
INFO: Load active rules (done) | time=985ms
INFO: Indexing files...
INFO: Project configuration:
INFO: 41 files indexed
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for ts: Sonar way
INFO: ------------- Run sensors on module Sonar_Extensure_test_11
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=21ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=1ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
INFO: Sensor SonarJS Coverage [javascript]
INFO: Analysing [/var/jenkins_home/workspace/sonar_result_test/./coverage/lcov.info]
INFO: Load project repositories
INFO: Load project repositories (done) | time=18ms
WARN: Could not resolve 3 file paths in [/var/jenkins_home/workspace/sonar_result_test/./coverage/lcov.info]
WARN: First unresolved path: coverage/lcov-report/block-navigation.js (Run in DEBUG mode to get full list of unresolved paths)
INFO: Sensor SonarJS Coverage [javascript] (done) | time=76ms
INFO: Sensor TypeScript analysis [javascript]
INFO: Using TypeScript at: '/var/jenkins_home/workspace/sonar_result_test/node_modules'
INFO: Found 1 tsconfig.json file(s): [/var/jenkins_home/workspace/sonar_result_test/tsconfig.json]
INFO: 40 source files to be analyzed
INFO: Analyzing 40 files using tsconfig: /var/jenkins_home/workspace/sonar_result_test/tsconfig.json
WARN: You are using version of TypeScript 3.9.9 which is not officially supported; supported versions >=3.2.1 <3.8.0
INFO: 40/40 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=5156ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=2ms
INFO: Sensor SonarTS [typescript]
INFO: Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.
INFO: Sensor SonarTS [typescript] (done) | time=0ms
INFO: Sensor Generic Test Executions Report
INFO: Parsing /var/jenkins_home/workspace/sonar_result_test/xunit.xml
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 9 unknown files, including:
/var/jenkins_home/workspace/sonar_result_test/lib/tests/bots/dialogAndWelcomeBot.test.js
/var/jenkins_home/workspace/sonar_result_test/lib/tests/dialogs/bookingDialog.test.js
/var/jenkins_home/workspace/sonar_result_test/lib/tests/dialogs/cancelAndHelpDialog.test.js
/var/jenkins_home/workspace/sonar_result_test/lib/tests/dialogs/dateResolverDialog.test.js
/var/jenkins_home/workspace/sonar_result_test/lib/tests/dialogs/emailValidator.test.js
INFO: Sensor Generic Test Executions Report (done) | time=43ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=4ms
INFO: CPD Executor 3 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 37 files
INFO: CPD Executor CPD calculation finished (done) | time=32ms
INFO: Analysis report generated in 62ms, dir size=286 KB
INFO: Analysis report compressed in 88ms, zip size=131 KB
INFO: Analysis report uploaded in 22ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://192.168.157.161:9000/dashboard?id=Sonar_Extensure_test_11
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://192.168.157.161:9000/api/ce/task?id=AXjGF56xh6OZzIOB-uWs
INFO: Analysis total time: 8.455 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 9.134s
INFO: Final Memory: 17M/253M
INFO: ------------------------------------------------------------------------

Not able to understand why this is happening:
INFO: Test execution data ignored for 9 unknown files, including:
/var/jenkins_home/workspace/sonar_result_test/lib/tests/bots/dialogAndWelcomeBot.test.js
/var/jenkins_home/workspace/sonar_result_test/lib/tests/dialogs/bookingDialog.test.js
/var/jenkins_home/workspace/sonar_result_test/lib/tests/dialogs/cancelAndHelpDialog.test.js
/var/jenkins_home/workspace/sonar_result_test/lib/tests/dialogs/dateResolverDialog.test.js
/var/jenkins_home/workspace/sonar_result_test/lib/tests/dialogs/emailValidator.test.js

The coverage is visible but the unit test are not…

How do i get the unit test result on sonarqube
Please let me know what is missing here

Hi @Sayali_Bhase ,

Welcome to SonarSource Community! :sonarsource:

Have you verified that your generic execution data format matches the requirements as listed here? Generic Test Data | SonarQube Docs (Generic Execution section)

Please verify that the format matches the one in the documentation.

Joe

Hello @Joe,
The report is generated by “mocha-sonarqube-reporter” is used which is in proper format…

test_result.txt (3.6 KB)
The file contains the result which is being generated in xml format.

Is this the right information provided to soanrqube?
Which package do you recommend generate report which can accepted by sonarqube.

Please suggest!

Thanks for the test file. It looks OK but the log entries seem to give the hint:

These warnings should help give a hint now. I missed this on my first read-through of your logs. (By the way, if you add -X to your sonar-scanner command, you’ll get DEBUG level logs so you get more information.)

Your test file looks OK, but it seems that you are having path issues defined in both the lcov.info (even though you get coverage results imported correctly?) and the xunit.xml file.

Are these files present? Can you check the directories and see if the file is there?

Would you mind sharing your project with me so I can try replicating your problem? You can message me privately if you prefer (from the main Discourse page on community.sonarsource.com/, create a new topic and click on the + button to create a new private message).

Hey @Joe,
yes, the file paths are present at the given path.
The coverage result are imported correctly but the unit test are not showing up…
Could you please help me understand it.!

I am still not able to get the result.
Tried with:

  1. mocha-sonarqube-reporter
  2. jest-sonar-reporter → format not supported.

able to see the coverage result but not the unit test cases.
Please suggest!

Unable to message you privately.
Please let me know how do i share my project details.

Hi @Sayali_Bhase ,

Sorry for delay, I was out sick.

You can message me privately here: create a “+ New Topic” from the front page of community.sonarsource.com and click on the + sign to create a new message: