The coverage of my project is not shown neither in sonarqube nor in sonarcloud it is 0%k

Hello everyone, I am trying to upload an example project to a local sonarqube (Version 9.4) and it shows me when uploading it that it does not have coverage, so I have investigated by looking at the log when uploading it I get

INFO: Imported coverage data for 0 files
INFO: Coverage data ignored for 3 unknown files, including:
Test/swift-coverage-example/AppDelegate.swift
Test/swift-coverage-example/AppDelegate2.swift
test/swift-coverage-exampleTests/swift_coverage_exampleTests.swift

This from what I see is because the coverage is not being shown in sonarqube, I am guiding myself from this documentation (How to set up SonarQube and integrate it with Codemagic | Codemagic Blog) In the native ios part there is a codemagic that executes a script “bash xccov-to-sonarqube-generic.sh Build/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml” will output an .xml something like this.

This is just an example, I will put the xml as an attachment

<coverage version="1">
   <file path="Test/swift-coverage-example/AppDelegate.swift">
     <lineToCover lineNumber="17" covered="true"/>
     <lineToCover lineNumber="18" covered="true"/>
   </file>
</coverage>

My sonar-project.properties contains the following: sonar.projectKey=swift-coverage-example11
sonar.sources=Test
sonar.host.url=http://localhost:9000
sonar.coverageReportPaths=sonarqube-generic-coverage.xml
sonar.login=LOGIN
sonar.cfamily.build-wrapper-output.bypass=true
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

Also, from what I know, the sonarqube community accepts xml and I don’t understand why it doesn’t show me a coverage, I have also tried to use a sonarcloud, I made an account and everything continues without success, showing the coverage of my project on that xml that is generated , I will share the xml I will put it in the .rar. Thanks for your time
Sonarqube.zip (607 Bytes)

Hi,

Welcome to the community!

What this is telling you is that SonarQube (and SonarCloud) can’t correlate the files listed in your coverage report with the files its finding in analysis.

You need to make sure the path SonarQube sees for E.G. AppDelegate.swift matches the path that’s in your coverage report.

 
Ann

Hello Thanks for answering, a query, this is the example project that I have (https://github.com/JeremyRoman99/IosCodemagicprueba123) there in the test folder are all the files related to the xml and in the xml test that I shared with you You also say the path <file path="Test/swift-coverage-example/AppDelegate.swift">, I thought that sonarqube was not finding the xml in my project and I decided to also put it in the administration-> Configuration-> part Jacoco and put the route there in this case if you find sonarqube-generic-coverage.xml in the root but it still doesn’t show me the coverage.

Hi,

Take a closer look at my initial reply, please.

 
Ann