Problems exporting Xcode14 unit test report to Sonar

I have an Xcode Project, using the Swift language, with some Unit tests, that I am trying to export the coverage information to Sonar. I have faced some issues, but first of all…


  • SonarQube 9.7.1
  • SonarScanner
  • Java Homebrew (64-bit)
  • Mac OS X 12.6 x86_64
  • Xcode 14.0

So far I tried some things:

The problems:

1 - The generated sonarqube-generic-coverage.xml file came with some wrong characters: &. I had to remove this in order to the Sonar scanner works.

2 - After that the Sonar Scanner had been completed, but the coverage information was 0%. Checking the error/warning outputs I could realize that the following message appeared for every class:

DEBUG: Skipping file '<< MY CLASS >>'in the generic coverage report because it doesn’t have a known language.

The project language is swift, and its contemplated in the properties file:

There is no “-Dsonar.objc.file.suffixes=-” in my properties.

I have already tried lots of thins, but I am still not able to see my code coverage in the Sonar.

What should I do? Is there any updated tutorial about using Sonar to see the Swift Xcode project, coverage and etc?

I already appreciate


Welcome to the community!

Can you share your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.


Hello Ann!

Thanks for the answer!

The Swift Code Quality and Security Sensor is not appearing in the execution logs, neither skipped nor used (we are searching for the output file for the Swift Sensor right?).

It’s not possible to insert the whole execution log here because it crosses the character limit here in the post. :frowning:

I found an analysis.log file in the PROJECT_FOLDER/.scannerwork/scanner-report/analysis.log. Don’t know if it helps

The content is:

Bundled analyzers:
  - Python Code Quality and Security (python)
  - Go Code Quality and Security (go)
  - JaCoCo (jacoco)
  - Kotlin Code Quality and Security (kotlin)
  - IaC Code Quality and Security (iac)
  - JavaScript/TypeScript/CSS Code Quality and Security (javascript)
  - Ruby Code Quality and Security (ruby)
  - Scala Code Quality and Security (sonarscala)
  - C# Code Quality and Security (csharp)
  - Java Code Quality and Security (java)
  - HTML Code Quality and Security (web)
  - Flex Code Quality and Security (flex)
  - XML Code Quality and Security (xml)
  - PHP Code Quality and Security (php)
  - Text file Code Quality and Security (text)
  - VB.NET Code Quality and Security (vbnet)
  - Configuration detection fot Code Quality and Security (config)
Global server settings:
  - sonar.core.startTime=2022-12-02T16:29:34-0300
  - sonar.forceAuthentication=true
Project server settings:
Project scanner properties:
  - sonar.coverageReportPaths=sonarqube-generic-coverage.xml
  - sonar.exclusions=**/*.xml,Pods/**/*,Reports/**/*
  - sonar.language=Swift
  - sonar.login=******
  - sonar.password=******
  - sonar.projectBaseDir=/Users/filiponegrao/projects/mobilidade-app-ios
  - sonar.projectDescription=prjDescription
  - sonar.projectKey=Teste-Renner
  - sonar.projectName=Teste-Renner
  - sonar.scanner.appVersion=
  - sonar.sourceEncoding=UTF-8
  - sonar.sources=.
  - sonar.swift.appConfiguration=Debug
  - sonar.swift.appScheme=RennerMobile
  - sonar.swift.excludedPathsFromCoverage=.*Tests.*
  - sonar.swift.project=RennerMobile.xcodeproj
  - sonar.swift.simulator=platform=iOS Simulator,name=iPhone SE (2nd generation),OS=15.0
  - sonar.swift.tailor.config=--no-color --max-line-length=100 --max-file-length=500 --max-name-length=40 --max-name-length=40 --min-name-length=4
  - sonar.swift.workspace=RennerMobile.xcworkspace
  - sonar.test.inclusions=*.swift
  - sonar.tests=LojasRennerUnitTests
  - sonar.verbose=true

Any ideas?

Thanks in advance


What edition are you using? You can check in the page footer. I’m guessing you’re on Community Edition, which doesn’t include Swift.


Wow! I am definitely using Community version:

I didn’t know Swift language it was only included on payed versions.


Prices for Developer Edition($), which includes Swift, are very reasonable for small instances. :smiley:


1 Like

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