Sonarswift code coverage

Hi,

We are working on for the sonar swift code coverage using following document.

But i am getting following error while doing the steps.
Error: Error Domain=XCCovErrorDomain Code=0 “Failed to load result bundle” UserInfo={NSLocalizedDescription=Failed to load result bundle, NSUnderlyingError=0x7faaea708c20 {Error Domain=IDEFoundation.ResultBundleError Code=0 “This version of Xcode does not support opening result bundles created with versions of Xcode and xcodebuild using the v1 API.”}}

My current mac versions are as follows:
Xcode 11.1
Build version 11A1027

Can you please help me getting those reports.

Thanks,
Amit

What is the command you are executing?

Following command was executed.
bash xccov-to-sonarqube-generic.sh Build/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml

Hi Team,

Is there any update for me? We need to get the coverage report and we are stuck with it since many days. Please help us. Thank you

I am expecting the answers. Thank you.

Hi Elena Vilchik,

Did you get time to look into my request? Thank you.

Hi @Amit_Kumar,

Here there was the same problem reported, and problem was in quotes. Try to run your command somehow differently, e.g. ./xccov-to-sonarqube-generic.sh Build/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml, try to add quotes around parameters.

You can also run commands inside xccov-to-sonarqube-generic.sh manually to understand which step makes it fail

Thank you so much. It worked.:blush:

Hi Elena,

Our project is having both swift and objective c codes. So sonarswift is analyzing swift codes but it is not analyzing objc code. Can you help me finding a solution for both swift and objc. What plugin should be used in order to get both.

I have gone through the generic coverage documents and specified sonar.coverageReportPaths path as well. but execution is getting failed stating following error.

ERROR: Error during SonarQube Scanner execution
ERROR: Error during parsing of the generic coverage report
ERROR: Caused by: report refers to a file with an unknown language

Hi All,

I’m also getting same issue which you were getting Amit.

SGMUOB4KNG8WN:ios nxgdev09$ sh xccov-to-sonarqube-generic.sh “/DerivedData/Logs/Test/*.xcresult” > sonarqube.generic-coverage.xml

Error: Error Domain=XCCovErrorDomain Code=0 “Failed to load result bundle” UserInfo={NSLocalizedDescription=Failed to load result bundle, NSUnderlyingError=0x7fdf41600e20 {Error Domain=IDEFoundation.ResultBundleError Code=0 “This version of Xcode does not support opening result bundles created with versions of Xcode and xcodebuild using the v1 API.”}}

Could someone help us to identify the root cause in xcode11.3.

Just use slather :wink:

slather coverage --sonarqube-xml --scheme "<scheme>" --workspace "<project.xcworkspace>" <project.xcodeproj>

The --workspace param is optional.

After using slather sonarqube_xml: true, still there is no coverage…