# Xcode code coverage to sonarcloud for iOS process

**URL:** <https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737>\
**Category:** SonarQube Cloud\
**Tags:** swift, coverage\
**Created:** [February 22, 2022, 4:56am UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737 "2022-02-22T04:56:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vreddy\_Ark](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vreddy_ark/32/29082_2.png) [@Vreddy\_Ark](https://community.sonarsource.com/u/Vreddy_Ark)\
**Post date:** [February 22, 2022, 4:56am UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737/1 "2022-02-22T04:56:26Z")

</div>

```auto
- name: Gather code coverage
        run: |
          xcodebuild test \
          -workspace xxxx.xcworkspace \
          -scheme xxxxxxUnitTests \
          -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.2' -enableCodeCoverage YES

```

getting results in .xcresults format so how to get the coverage data to sonarcloud using sonar.properties

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [February 22, 2022, 10:57am UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737/2 "2022-02-22T10:57:37Z")

</div>

Hey there.

Take a look at this thread:

> [@\[Coverage & Test Data\] Generate Reports for Swift](https://community.sonarsource.com/t/coverage-test-data-generate-reports-for-swift/9700):
>
> Here is a quick guide on importing your Coverage or Test Data reports into SonarQube. These commands were used when we implemented this feature. If you use other commands, feel free to share them as replies. If you have trouble importing your Coverage or Test data reports, please ask for help on the corresponding SonarQube Server / Community Build or SonarQube Cloud category. Rely on the “Generic Test Data” SonarQube supports a [generic coverage format](https://docs.sonarqube.org/latest/analyzing-source-code/test-coverage/generic-test-data/), allowing you to load any coverage report …

---

<div class="post-metadata">

**Author:** ![Vreddy\_Ark](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vreddy_ark/32/29082_2.png) [@Vreddy\_Ark](https://community.sonarsource.com/u/Vreddy_Ark)\
**Post date:** [February 22, 2022, 9:33pm UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737/3 "2022-02-22T21:33:01Z")

</div>

Tried the same one as above in GitHub Actions but

`Error during parsing of the generic coverage report '/github/workspace'. Look at SonarQube documentation to know the expected XML format`.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [February 23, 2022, 8:13am UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737/4 "2022-02-23T08:13:30Z")

</div>

Since `/github/workspace` refers to a directory, I would guess something is wrong in your configuration. Can you share your full GitHub Actions YML file?

---

<div class="post-metadata">

**Author:** ![Vreddy\_Ark](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vreddy_ark/32/29082_2.png) [@Vreddy\_Ark](https://community.sonarsource.com/u/Vreddy_Ark)\
**Post date:** [February 23, 2022, 11:45pm UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737/5 "2022-02-23T23:45:01Z")

</div>

the above issue got resolved but the sonar cloud was unable to identify the

`sonar.coverageReportPaths=sonarqube-generic-coverage.xml`

in sonar-project.properties.

Error during parsing of the generic coverage report ‘sonarqube-generic-coverage.xml’. Look at SonarQube documentation to know the expected XML format.

---

<div class="post-metadata">

**Author:** ![Vreddy\_Ark](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/vreddy_ark/32/29082_2.png) [@Vreddy\_Ark](https://community.sonarsource.com/u/Vreddy_Ark)\
**Post date:** [February 24, 2022, 6:40am UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737/6 "2022-02-24T06:40:55Z")

</div>

what is the procedure if we need to send the sonarqube-generic-coverage.xml in sonar cloud with sonar scanner as github actions

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [February 24, 2022, 10:47am UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737/7 "2022-02-24T10:47:20Z")

</div>

Hey there.

> Error during parsing of the generic coverage report ‘sonarqube-generic-coverage.xml’. Look at SonarQube documentation to know the expected XML format.

You may want to run a `cat sonarqube-generic-coverage.xml` within GitHub actions to make sure the file matches the [expected format](https://docs.sonarcloud.io/enriching/test-coverage/generic-test-data/).

And, as asked previously, if you still face issues it would be useful to share your full GitHub Actions YML file.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [March 7, 2022, 10:07pm UTC](https://community.sonarsource.com/t/xcode-code-coverage-to-sonarcloud-for-ios-process/58737/8 "2022-03-07T22:07:50Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
