No Code Coverage Report Generated sonar-scanner-4.6.0.2311-windows

I have generated Code coverage using llvm-cov and from the logs I can see that the llvm-cov report is being parsed.

10:45:29.708 INFO: Sensor llvm-cov [cpp]
10:45:29.708 INFO: Parsing C:\Users\circleci\project\coverage\tests\coverage-reports\coverage_show.txt
10:45:29.717 DEBUG: 'DopeCloudInterface/include/DopeCloudInterface.h' generated metadata with charset 'windows-1252'
10:45:29.729 DEBUG: 'DopeCloudInterface/include/HttpRequest.h' generated metadata with charset 'windows-1252'
10:45:29.731 DEBUG: 'DopeCloudInterface/src/DopeCloudInterface.cpp' generated metadata with charset 'windows-1252'
10:45:29.737 DEBUG: 'DopeCloudInterface/src/HttpRequest.cpp' generated metadata with charset 'windows-1252'
10:45:29.737 DEBUG: 'configManager/include/ConfigManager.h' generated metadata with charset 'windows-1252'
10:45:29.737 DEBUG: 'configManager/include/ConfigObserverInterface.h' generated metadata with charset 'windows-1252'
10:45:29.737 DEBUG: 'configManager/include/ConfigParser.h' generated metadata with charset 'windows-1252'
10:45:29.745 DEBUG: 'configManager/src/ConfigManager.cpp' generated metadata with charset 'windows-1252'
10:45:29.746 DEBUG: 'configManager/src/ConfigParser.cpp' generated metadata with charset 'windows-1252'
10:45:29.746 DEBUG: 'logging/include/DopeLogging.h' generated metadata with charset 'windows-1252'
10:45:29.746 DEBUG: 'logging/src/DopeLogging.cpp' generated metadata with charset 'windows-1252'
10:45:29.746 DEBUG: 'policy/include/CategoryCache.h' generated metadata with charset 'windows-1252'
10:45:29.759 DEBUG: 'policy/include/PolicyEngine.h' generated metadata with charset 'windows-1252'
10:45:29.760 DEBUG: 'policy/include/ThreadPool.h' generated metadata with charset 'windows-1252'
10:45:29.763 DEBUG: 'policy/src/CategoryCache.cpp' generated metadata with charset 'windows-1252'
10:45:29.763 DEBUG: 'policy/src/DomainBypass.cpp' generated metadata with charset 'windows-1252'
10:45:29.770 DEBUG: 'policy/src/PolicyEngine.cpp' generated metadata with charset 'windows-1252'
10:45:29.770 DEBUG: 'policy/src/PolicyEnums.cpp' generated metadata with charset 'windows-1252'
10:45:29.775 DEBUG: 'policy/src/ThreadPool.cpp' generated metadata with charset 'windows-1252'
10:45:29.775 DEBUG: 'proxy/include/ConnectionStateMachine.h' generated metadata with charset 'windows-1252'
10:45:29.775 DEBUG: 'proxy/include/HTTPHeaderParser.h' generated metadata with charset 'windows-1252'
10:45:29.775 DEBUG: 'proxy/include/LocalDataProvider.h' generated metadata with charset 'windows-1252'
10:45:29.784 DEBUG: 'proxy/include/SSLHelloParser.h' generated metadata with charset 'windows-1252'
10:45:29.785 DEBUG: 'proxy/src/CertManagement.cpp' generated metadata with charset 'windows-1252'
10:45:29.791 DEBUG: 'proxy/src/SSLHelloParser.cpp' generated metadata with charset 'windows-1252'
10:45:29.794 DEBUG: 'utils/src/FileUtils.cpp' generated metadata with charset 'windows-1252'
10:45:29.794 DEBUG: 'utils/src/StringUtils.cpp' generated metadata with charset 'windows-1252'
10:45:29.797 DEBUG: 'utils/src/win/ConfigInfo.cpp' generated metadata with charset 'windows-1252'
10:45:29.799 DEBUG: 'utils/src/win/WinFileUtils.cpp' generated metadata with charset 'windows-1252'
10:45:29.799 INFO: Sensor llvm-cov [cpp] (done) | time=91ms

However I do not see code coverage report being generated.
I see the following in the logs,

10:45:29.800 INFO: Sensor JaCoCo XML Report Importer [jacoco]
10:45:29.801 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
10:45:29.801 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
10:45:29.801 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=1ms

Where can I find jacocoTestReport.xml? How does it get generated?

Can someone from SONAR support please reply to my query?

Hi @Rohan_Hathiwala ,

this part of the log lets me imply that some coverage information has been imported by the sensor. Are you trying to do that in a branch or in the main branch? You should try in the main branch because if you do it in a branch the coverage for non-modified files may not be displayed.

Thanks Massimo for your reply. I am doing this off a branch I created from the master branch.
Can you provide some more insight as to why this would work if I tried to get coverage report off the master branch?

Hi @Rohan_Hathiwala ,

you can have a read at Branch Analysis documentation page and the definition of New Code. They define what is shown relevant to a branch, by default the results are filtered to the list of the modified files.

Hi Massimo,
So every time I run sonar-scanner on my branch it will compare against the base/master branch and give code coverage results only for the modified files as sonar internally does a comparison between current branch and master branch?
But if I run sonar-scanner against the master branch it will give me code coverage results every time?
Is my understanding correct?
Regards,
Rohan Hathiwala.

Hi @Rohan_Hathiwala ,

yes, I believe this is what happening with the default new code definition.

On the main branch, everything is imported, for all indexed files.

You can change a branch to be a branch independent from the main branch if you need to test before merging to the main branch.