Unit Test Coverage Not Working

Hi
I am currently running SonarQube Enterprise v8.3 and having issue with unit test coverage.

I have a Maven JavaScript script project using Jasmine Unit Test Framework with Mocking.
The build pipeline from TeamCity is looking good showing the number of unit test executed, however that isn’t reflected on the SonarQube dashboard.

Have also tried converting the unit test execution report to a generic execution report without luck.
Getting the following message from build pipeline.
INFO: Sensor Generic Test Executions Report
INFO: Parsing ./target/surefire-reports/testReport.xml
INFO: 11/11 source files have been analyzed
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 1 unknown files, including: InfobloxClientTests.js
INFO: Sensor Generic Test Executions Report (done) | time=18ms

Could you please help and advise?

Thanks

Hi,

Welcome to the community!

You would need to explicitly feed your report into analysis, but from the docs it doesn’t look like Jasmine is supported. Maybe you can convert the data to the Generic Test Data formats and go that way.

 
HTH,
Ann

Hi Ann,

Thanks for responding.
I have tried generic format and that made no difference.

Here are the additional analysis parameters I use
Original report
-Dsonar.tests=src/test/resources/lib/infoblox
-Dsonar.junit.reportsPath=target/surefire-reports
Generic report
-Dsonar.tests=src/test/resources/lib/infoblox
-Dsonar.testExecutionReportPaths=target/surefire-reports/testReport.xml

From log, the issue seems to be file path line in the generic report
Generic report
<testExecutions version=“1”>
<file path=“InfobloxClientTests.js”>
Log
INFO: Test execution data ignored for 1 unknown files, including: InfobloxClientTests.js

Have also tried providing full path to the file with no luck.

Any suggestions on how to resolve that?
Thanks

Hi,

Is InfobloxClientTests.js located in the project root? I’m betting not. You need to provide not the file name but it’s path, relative to project root.

 
Ann