Unable to import Xcode Coverage data on XCode 12

Hi,

We are getting this error when running xccov-to-sonarqube-generic.sh script on XCode 12 to generate XML coverage file.
Error: Error Domain=XCCovErrorDomain Code=0 "Failed to load result bundle" UserInfo={NSLocalizedDescription=Failed to load result bundle, NSUnderlyingError=0x7fc20a10a960 {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."}}

Do we have an update regarding the new XCode version?

I’m running the script as shown:
./xccov-to-sonarqube-generic.sh "/DerivedData/Logs/Test/*.xcresult" > sonarqube.generic-coverage.xml

XCode Version 12.0.1 (12A7300)

@danielmaion Did you find out any solution for XCode 12?

@danielmaion: Check this post for someone having similar issues: Sonarswift code coverage - #7 by Lena
which references a github issue too: Update xccov-to-sonarqube-generic.sh for xcode 11 by emanuelschmoczer · Pull Request #64 · SonarSource/sonar-scanning-examples · GitHub

I was able to successfully run the code coverage script on my macOS 10.15.7 in the Swift code coverage example repo: Xcode 12.1, but I got a bunch of warnings, which look harmless. The code coverage file was created. Maybe test the script on this example repo first and see what results you get.

$ ./xccov-to-sonarqube-generic.sh Build/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml                                                                                                             
2020-10-25 12:31:59.817 xccov[17717:2117195] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
2020-10-25 12:32:00.392 xccov[17719:2117257] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
2020-10-25 12:32:00.610 xccov[17721:2117318] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
2020-10-25 12:32:00.738 xccov[17723:2117380] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
2020-10-25 12:32:00.864 xccov[17725:2117439] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
2020-10-25 12:32:00.991 xccov[17727:2117502] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
2020-10-25 12:32:01.121 xccov[17729:2117562] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
2020-10-25 12:32:01.258 xccov[17731:2117623] Requested but did not find extension point with identifier Xcode.IDEFoundation.IDEResultKitSerializationConverter
$ cat sonarqube-generic-coverage.xml                                                 
<coverage version="1">
  <file path="/Users/jting/Projects/sonar-scanning-examples/swift-coverage/swift-coverage-example/swift-coverage-example/AppDelegate.swift">
    <lineToCover lineNumber="17" covered="true"/>
    <lineToCover lineNumber="18" covered="true"/>
    <lineToCover lineNumber="19" covered="true"/>
    <lineToCover lineNumber="21" covered="false"/>
    <lineToCover lineNumber="22" covered="false"/>
    <lineToCover lineNumber="23" covered="false"/>
    <lineToCover lineNumber="29" covered="true"/>
    <lineToCover lineNumber="30" covered="true"/>
    <lineToCover lineNumber="31" covered="false"/>
    ...

EDIT: I see people commenting on the errors I got after I ran the xccov script here.

I solved this by using slather.
See Sonarswift code coverage - #13 by d4Rk

1 Like