Sonar Cloud still shows 0% coverage for swift project build with Xcode 13

Hello Sonar Community,
I am analysing swift project using Xcode 13 with azure pipeline. I followed exactly same steps mentioned in documentation. Link
My sonar-properties files have following configuration keys

sonar.projectName=myProject
sonar.projectKey=myKey
sonar.organization= my_org
sonar.projectVersion=1.0

# =====================================================
#   Properties that will be shared amongst all modules
# =====================================================

# SQ standard properties
sonar.sources=Project
sonar.swift.project=MyProject.xcodeproj
sonar.swift.workspace=MyProject.xcworkspace
sonar.swift.simulator=platform=iOS Simulator,name=iPhone 12,OS=14.5

#Scheme to build your application
sonar.swift.appScheme=MyProject

# Properties to cover test-cases
sonar.test.inclusions=*Tests/*.swift
sonar.test.inclusions=*.swift
sonar.exclusions=**/*.xml,Pods/**/*,Reports/**/*
sonar.tests= MyProjectTests
sonar.coverageReportPaths=sonarqube-generic-coverage.xml
sonar.swift.coverage.reportPaths=sonarqube-generic-coverage.xml

# Properties remove c,c++, obj-c files path
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=- 
sonar.objc.file.suffixes=-

# Properties specific to the C and C++ analyzer:
sonar.cfamily.build-wrapper-output=build_wrapper_output_directory

and my yml file have configuration

trigger:
- devBranch
jobs:
- job: SonarCloudBuild
  displayName: Build for MacOS\XCode With SonarCloud
  pool:
    vmImage: 'macos-latest'
  steps:
  - task: SonarCloudPrepare@1
    inputs:
      SonarCloud: 'iOS Connection' # Name of the SonarCloud service connection you created
      organization: 'my_org'
      scannerMode: 'CLI'
      configMode: 'file'
  - task: SonarCloudAnalyze@1

Pipeline successfully completes but code coverage still shows 0%. Although I have written test-cases.

Regards,
Yasir Khan

Hi Yasir,

Can you post your analysis log?

 
Ann

Hi Ann,
Below is the screenshot of Azure pipeline analysis.

Hi,

Thanks for this. Unfortunately, it doesn’t include the part that’s interesting w/r/t coverage import. Can you copy/paste the full text of your entire analysis log, starting from the analysis command, and ending with what you’ve screenshot-ed above?

 
Ann

Hi,
Below is the full analysis log

2022-10-14T19:11:26.5755880Z ##[section]Starting: SonarCloudAnalyze
2022-10-14T19:11:26.5769440Z ==============================================================================
2022-10-14T19:11:26.5770170Z Task         : Run Code Analysis
2022-10-14T19:11:26.5770750Z Description  : Run scanner and upload the results to the SonarCloud server.
2022-10-14T19:11:26.5771410Z Version      : 1.33.0
2022-10-14T19:11:26.5771830Z Author       : sonarsource
2022-10-14T19:11:26.5772510Z Help         : Version: 1.33.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-for-azure-devops/)
2022-10-14T19:11:26.5773370Z ==============================================================================
2022-10-14T19:11:27.1908820Z [command]/Users/runner/work/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.33.0/sonar-scanner/bin/sonar-scanner
2022-10-14T19:11:28.5028010Z INFO: Scanner configuration file: /Users/runner/work/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.33.0/sonar-scanner/conf/sonar-scanner.properties
2022-10-14T19:11:28.5074630Z INFO: Project root configuration file: /Users/runner/work/1/s/sonar-project.properties
2022-10-14T19:11:28.5881000Z INFO: SonarScanner 4.7.0.2747
2022-10-14T19:11:28.5936580Z INFO: Java 11.0.16.1 Eclipse Adoptium (64-bit)
2022-10-14T19:11:28.5980320Z INFO: Mac OS X 11.7 x86_64
2022-10-14T19:11:29.6150310Z INFO: User cache: /Users/runner/.sonar/cache
2022-10-14T19:11:34.5424530Z INFO: Scanner configuration file: /Users/runner/work/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.33.0/sonar-scanner/conf/sonar-scanner.properties
2022-10-14T19:11:34.5498120Z INFO: Project root configuration file: /Users/runner/work/1/s/sonar-project.properties
2022-10-14T19:11:34.5499630Z INFO: Analyzing on SonarCloud
2022-10-14T19:11:34.5506290Z INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
2022-10-14T19:11:35.4325880Z INFO: Load global settings
2022-10-14T19:11:36.2995120Z INFO: Load global settings (done) | time=861ms
2022-10-14T19:11:36.3120570Z INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu
2022-10-14T19:11:36.3363880Z INFO: User cache: /Users/runner/.sonar/cache
2022-10-14T19:11:36.3365310Z INFO: Load/download plugins
2022-10-14T19:11:36.3466500Z INFO: Load plugins index
2022-10-14T19:11:37.1905320Z INFO: Load plugins index (done) | time=854ms
2022-10-14T19:11:43.4797100Z INFO: Load/download plugins (done) | time=7150ms
2022-10-14T19:11:44.7973320Z INFO: Loaded core extensions: developer-scanner
2022-10-14T19:11:45.3698150Z INFO: Found an active CI vendor: 'Azure DevOps'
2022-10-14T19:11:45.3876050Z INFO: Load project settings for component key: 'Tapcheck_iOS_App'
2022-10-14T19:11:46.2040080Z INFO: Load project settings for component key: 'Tapcheck_iOS_App' (done) | time=817ms
2022-10-14T19:11:46.2104010Z INFO: Process project properties
2022-10-14T19:11:46.2181270Z INFO: Execute project builders
2022-10-14T19:11:46.2198900Z INFO: Execute project builders (done) | time=2ms
2022-10-14T19:11:46.2219390Z INFO: Project key: Tapcheck_iOS_App
2022-10-14T19:11:46.2220610Z INFO: Base dir: /Users/runner/work/1/s
2022-10-14T19:11:46.2221580Z INFO: Working dir: /Users/runner/work/1/s/.scannerwork
2022-10-14T19:11:46.3315120Z INFO: Load project branches
2022-10-14T19:11:47.1631010Z INFO: Load project branches (done) | time=832ms
2022-10-14T19:11:47.1662870Z INFO: Check ALM binding of project 'Tapcheck_iOS_App'
2022-10-14T19:11:47.9640690Z INFO: Detected project binding: NOT_BOUND
2022-10-14T19:11:47.9643170Z INFO: Check ALM binding of project 'Tapcheck_iOS_App' (done) | time=798ms
2022-10-14T19:11:47.9691030Z INFO: Load project pull requests
2022-10-14T19:11:48.7854370Z INFO: Load project pull requests (done) | time=819ms
2022-10-14T19:11:48.7881170Z INFO: Load branch configuration
2022-10-14T19:11:48.7897100Z INFO: Load branch configuration (done) | time=2ms
2022-10-14T19:11:48.8292300Z INFO: Load quality profiles
2022-10-14T19:11:49.6806210Z INFO: Load quality profiles (done) | time=852ms
2022-10-14T19:11:49.6868270Z INFO: Load active rules
2022-10-14T19:11:56.7811580Z INFO: Load active rules (done) | time=7094ms
2022-10-14T19:11:56.8250560Z INFO: Organization key: tapcheck
2022-10-14T19:11:56.8258130Z INFO: Branch name: branch-dev, type: long-lived
2022-10-14T19:11:56.8480490Z INFO: Load project repositories
2022-10-14T19:11:58.0796320Z INFO: Load project repositories (done) | time=1229ms
2022-10-14T19:11:58.1143170Z INFO: Indexing files...
2022-10-14T19:11:58.1260520Z INFO: Project configuration:
2022-10-14T19:11:58.1363540Z INFO:   Excluded sources: **/build-wrapper-dump.json, **/*.xml, Pods/**/*, Reports/**/*, *.swift
2022-10-14T19:11:58.1465540Z INFO:   Included tests: *.swift
2022-10-14T19:11:59.9286660Z INFO: 1687 files indexed
2022-10-14T19:11:59.9325240Z INFO: 12 files ignored because of inclusion/exclusion patterns
2022-10-14T19:11:59.9326570Z INFO: 0 files ignored because of scm ignore settings
2022-10-14T19:11:59.9328760Z INFO: Quality profile for json: SonarQube Way
2022-10-14T19:11:59.9334820Z INFO: Quality profile for swift: Sonar way
2022-10-14T19:12:00.0703570Z INFO: ------------- Run sensors on module Tapcheck - iOS App
2022-10-14T19:12:00.2626650Z INFO: Load metrics repository
2022-10-14T19:12:01.0521300Z INFO: Load metrics repository (done) | time=794ms
2022-10-14T19:12:04.1727030Z INFO: Sensor IaC CloudFormation Sensor [iac]
2022-10-14T19:12:04.3985570Z INFO: 0 source files to be analyzed
2022-10-14T19:12:04.4725390Z INFO: 0/0 source files have been analyzed
2022-10-14T19:12:04.4764180Z INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=300ms
2022-10-14T19:12:04.4812340Z INFO: Sensor IaC Kubernetes Sensor [iac]
2022-10-14T19:12:04.5574400Z INFO: 0 source files to be analyzed
2022-10-14T19:12:04.6428360Z INFO: 0/0 source files have been analyzed
2022-10-14T19:12:04.6432280Z INFO: Sensor IaC Kubernetes Sensor [iac] (done) | time=171ms
2022-10-14T19:12:04.6435810Z INFO: Sensor C# Project Type Information [csharp]
2022-10-14T19:12:04.6465020Z INFO: Sensor C# Project Type Information [csharp] (done) | time=2ms
2022-10-14T19:12:04.6550470Z INFO: Sensor C# Analysis Log [csharp]
2022-10-14T19:12:04.6624180Z INFO: Sensor C# Analysis Log [csharp] (done) | time=15ms
2022-10-14T19:12:04.6625750Z INFO: Sensor C# Properties [csharp]
2022-10-14T19:12:04.6626660Z INFO: Sensor C# Properties [csharp] (done) | time=0ms
2022-10-14T19:12:04.6627570Z INFO: Sensor HTML [web]
2022-10-14T19:12:04.6702770Z INFO: Sensor HTML [web] (done) | time=9ms
2022-10-14T19:12:04.6706890Z INFO: Sensor Text Sensor [text]
2022-10-14T19:12:04.6745490Z INFO: 730 source files to be analyzed
2022-10-14T19:12:05.0937260Z INFO: 730/730 source files have been analyzed
2022-10-14T19:12:05.1004080Z INFO: Sensor Text Sensor [text] (done) | time=423ms
2022-10-14T19:12:05.1015240Z INFO: Sensor VB.NET Project Type Information [vbnet]
2022-10-14T19:12:05.1056380Z INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
2022-10-14T19:12:05.1066120Z INFO: Sensor VB.NET Analysis Log [vbnet]
2022-10-14T19:12:05.1267930Z INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=21ms
2022-10-14T19:12:05.1316040Z INFO: Sensor VB.NET Properties [vbnet]
2022-10-14T19:12:05.1317330Z INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
2022-10-14T19:12:05.1320890Z INFO: Sensor Swift Code Quality and Security [swift]
2022-10-14T19:12:05.1321910Z INFO: 313 source files to be analyzed
2022-10-14T19:12:15.2509030Z INFO: 228/313 files analyzed, current file: TapCheck/Controllers/Account/PayCard/Card Managment/Card Activity/Adapter/CardActivityAdapter.swift
2022-10-14T19:12:17.9805130Z INFO: 313/313 source files have been analyzed
2022-10-14T19:12:17.9811830Z WARN: Property 'sonar.swift.coverage.reportPath' is deprecated and will be soon ignored, use 'sonar.swift.coverage.reportPaths' instead.
2022-10-14T19:12:18.1374470Z INFO: Parse coverage report (sonarqube-generic-coverage.xml)
2022-10-14T19:12:18.4194350Z INFO: Parse coverage report (sonarqube-generic-coverage.xml)
2022-10-14T19:12:18.5241090Z INFO: Sensor Swift Code Quality and Security [swift] (done) | time=13406ms
2022-10-14T19:12:18.5289600Z INFO: Sensor JaCoCo XML Report Importer [jacoco]
2022-10-14T19:12:18.5369920Z INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
2022-10-14T19:12:18.5374650Z INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
2022-10-14T19:12:18.5379400Z INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=5ms
2022-10-14T19:12:18.5380440Z INFO: Sensor CSS Rules [javascript]
2022-10-14T19:12:18.5381490Z INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
2022-10-14T19:12:18.5382770Z INFO: Sensor CSS Rules [javascript] (done) | time=3ms
2022-10-14T19:12:18.5387800Z INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
2022-10-14T19:12:18.5390230Z INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=3ms
2022-10-14T19:12:18.5392220Z INFO: Sensor Serverless configuration file sensor [security]
2022-10-14T19:12:18.5402700Z INFO: 0 Serverless function entries were found in the project
2022-10-14T19:12:18.5480200Z INFO: 0 Serverless function handlers were kept as entrypoints
2022-10-14T19:12:18.5487170Z INFO: Sensor Serverless configuration file sensor [security] (done) | time=11ms
2022-10-14T19:12:18.5489480Z INFO: Sensor AWS SAM template file sensor [security]
2022-10-14T19:12:18.5517780Z INFO: Sensor AWS SAM template file sensor [security] (done) | time=3ms
2022-10-14T19:12:18.5518630Z INFO: Sensor AWS SAM Inline template file sensor [security]
2022-10-14T19:12:18.5551340Z INFO: Sensor AWS SAM Inline template file sensor [security] (done) | time=2ms
2022-10-14T19:12:18.5552920Z INFO: Sensor Generic Coverage Report
2022-10-14T19:12:18.5555660Z INFO: Parsing /Users/runner/work/1/s/sonarqube-generic-coverage.xml
2022-10-14T19:12:19.1685300Z INFO: Imported coverage data for 0 files
2022-10-14T19:12:19.1705820Z INFO: Coverage data ignored for 2020 unknown files, including:
2022-10-14T19:12:19.1708380Z /Users/maxhina/Documents/Tapcheck/Pods/Charts/Source/Charts/Animation/Animator.swift
2022-10-14T19:12:19.1710940Z /Users/maxhina/Documents/Tapcheck/Pods/Charts/Source/Charts/Animation/ChartAnimationEasing.swift
2022-10-14T19:12:19.1712220Z /Users/maxhina/Documents/Tapcheck/Pods/Charts/Source/Charts/Charts/BarChartView.swift
2022-10-14T19:12:19.1713380Z /Users/maxhina/Documents/Tapcheck/Pods/Charts/Source/Charts/Charts/BarLineChartViewBase.swift
2022-10-14T19:12:19.1714540Z /Users/maxhina/Documents/Tapcheck/Pods/Charts/Source/Charts/Charts/BubbleChartView.swift
2022-10-14T19:12:19.1716550Z INFO: Sensor Generic Coverage Report (done) | time=616ms
2022-10-14T19:12:19.1717660Z INFO: Sensor javabugs [dbd]
2022-10-14T19:12:19.1722470Z INFO: Reading IR files from: /Users/runner/work/1/s/.scannerwork/ir/java
2022-10-14T19:12:19.1746600Z INFO: No IR files have been included for analysis.
2022-10-14T19:12:19.1754970Z INFO: Sensor javabugs [dbd] (done) | time=2ms
2022-10-14T19:12:19.1758440Z INFO: Sensor pythonbugs [dbd]
2022-10-14T19:12:19.1759500Z INFO: Reading IR files from: /Users/runner/work/1/s/.scannerwork/ir/python
2022-10-14T19:12:19.1760570Z INFO: No IR files have been included for analysis.
2022-10-14T19:12:19.1761540Z INFO: Sensor pythonbugs [dbd] (done) | time=1ms
2022-10-14T19:12:19.1762560Z INFO: Sensor JavaSecuritySensor [security]
2022-10-14T19:12:19.1764030Z INFO: Reading type hierarchy from: /Users/runner/work/1/s/.scannerwork/ucfg2/java
2022-10-14T19:12:19.1764930Z INFO: Read 0 type definitions
2022-10-14T19:12:19.1774140Z INFO: Reading UCFGs from: /Users/runner/work/1/s/.scannerwork/ucfg2/java
2022-10-14T19:12:19.1819920Z INFO: No UCFGs have been included for analysis.
2022-10-14T19:12:19.1868710Z INFO: Sensor JavaSecuritySensor [security] (done) | time=4ms
2022-10-14T19:12:19.1870190Z INFO: Sensor CSharpSecuritySensor [security]
2022-10-14T19:12:19.1874580Z INFO: Reading type hierarchy from: /Users/runner/work/1/s/ucfg_cs2
2022-10-14T19:12:19.1880800Z INFO: Read 0 type definitions
2022-10-14T19:12:19.1885120Z INFO: Reading UCFGs from: /Users/runner/work/1/s/ucfg_cs2
2022-10-14T19:12:19.1951070Z INFO: No UCFGs have been included for analysis.
2022-10-14T19:12:19.1952420Z INFO: Sensor CSharpSecuritySensor [security] (done) | time=0ms
2022-10-14T19:12:19.1953000Z INFO: Sensor PhpSecuritySensor [security]
2022-10-14T19:12:19.1953550Z INFO: Reading type hierarchy from: /Users/runner/work/1/s/.scannerwork/ucfg2/php
2022-10-14T19:12:19.1954030Z INFO: Read 0 type definitions
2022-10-14T19:12:19.1954470Z INFO: Reading UCFGs from: /Users/runner/work/1/s/.scannerwork/ucfg2/php
2022-10-14T19:12:19.1955680Z INFO: No UCFGs have been included for analysis.
2022-10-14T19:12:19.1956560Z INFO: Sensor PhpSecuritySensor [security] (done) | time=0ms
2022-10-14T19:12:19.1957440Z INFO: Sensor PythonSecuritySensor [security]
2022-10-14T19:12:19.1958320Z INFO: Reading type hierarchy from: /Users/runner/work/1/s/.scannerwork/ucfg2/python
2022-10-14T19:12:19.1959910Z INFO: Read 0 type definitions
2022-10-14T19:12:19.1960790Z INFO: Reading UCFGs from: /Users/runner/work/1/s/.scannerwork/ucfg2/python
2022-10-14T19:12:19.1961670Z INFO: No UCFGs have been included for analysis.
2022-10-14T19:12:19.1962480Z INFO: Sensor PythonSecuritySensor [security] (done) | time=0ms
2022-10-14T19:12:19.1963340Z INFO: Sensor JsSecuritySensor [security]
2022-10-14T19:12:19.1964200Z INFO: Reading type hierarchy from: /Users/runner/work/1/s/.scannerwork/ucfg2/js
2022-10-14T19:12:19.1965000Z INFO: Read 0 type definitions
2022-10-14T19:12:19.1965850Z INFO: Reading UCFGs from: /Users/runner/work/1/s/.scannerwork/ucfg2/js
2022-10-14T19:12:19.1966870Z INFO: No UCFGs have been included for analysis.
2022-10-14T19:12:19.1967700Z INFO: Sensor JsSecuritySensor [security] (done) | time=0ms
2022-10-14T19:12:19.1969400Z INFO: ------------- Run sensors on project
2022-10-14T19:12:19.2282790Z INFO: Sensor Analysis Warnings import [csharp]
2022-10-14T19:12:19.2293340Z INFO: Sensor Analysis Warnings import [csharp] (done) | time=1ms
2022-10-14T19:12:19.2294460Z INFO: Sensor Zero Coverage Sensor
2022-10-14T19:12:19.3925590Z INFO: Sensor Zero Coverage Sensor (done) | time=164ms
2022-10-14T19:12:19.5831180Z INFO: SCM Publisher SCM provider for this project is: git
2022-10-14T19:12:19.5862740Z INFO: SCM Publisher 11 source files to be analyzed
2022-10-14T19:12:19.6593600Z INFO: Blaming files using native implementation
2022-10-14T19:12:19.8138050Z INFO: Blaming files using native implementation (done) | time=155ms
2022-10-14T19:12:19.8227310Z INFO: SCM Publisher 5/11 source files have been analyzed (done) | time=235ms
2022-10-14T19:12:19.8229020Z WARN: Missing blame information for the following files:
2022-10-14T19:12:19.8232680Z WARN:   * TapCheck/Assets.xcassets/PayCard/paycard_logo.imageset/Contents.json
2022-10-14T19:12:19.8234670Z WARN:   * TapCheck/Assets.xcassets/PayCard/e-statment_icon.imageset/Contents.json
2022-10-14T19:12:19.8235710Z WARN:   * TapCheck/Assets.xcassets/PayCard/download_icon.imageset/Contents.json
2022-10-14T19:12:19.8236810Z WARN:   * TapCheck/Assets.xcassets/PayCard/download_arrow_down.imageset/Contents.json
2022-10-14T19:12:19.8237830Z WARN:   * TapCheck/Assets.xcassets/PayCard/paycard_more_icon.imageset/Contents.json
2022-10-14T19:12:19.8239610Z WARN:   * TapCheck/Assets.xcassets/PayCard/paycard_bg.imageset/Contents.json
2022-10-14T19:12:19.8240620Z WARN: This may lead to missing/broken features in SonarCloud
2022-10-14T19:12:19.8676370Z INFO: CPD Executor 18 files had no CPD blocks
2022-10-14T19:12:19.8677970Z INFO: CPD Executor Calculating CPD for 295 files
2022-10-14T19:12:20.1023780Z INFO: CPD Executor CPD calculation finished (done) | time=234ms
2022-10-14T19:12:23.2974780Z INFO: Analysis report generated in 3070ms, dir size=3 MB
2022-10-14T19:12:25.8198910Z INFO: Analysis report compressed in 2522ms, zip size=1 MB
2022-10-14T19:12:27.8640430Z INFO: Analysis report uploaded in 2044ms
2022-10-14T19:12:27.8661520Z INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=Tapcheck_iOS_App&branch=branch-dev
2022-10-14T19:12:27.8663070Z INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
2022-10-14T19:12:27.8664350Z INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=AYPX6YA_w1XYBKl515de
2022-10-14T19:12:28.4701900Z INFO: Analysis total time: 43.674 s
2022-10-14T19:12:28.4735870Z INFO: ------------------------------------------------------------------------
2022-10-14T19:12:28.4736550Z INFO: EXECUTION SUCCESS
2022-10-14T19:12:28.4737480Z INFO: ------------------------------------------------------------------------
2022-10-14T19:12:28.4738050Z INFO: Total time: 59.992s
2022-10-14T19:12:28.6315720Z INFO: Final Memory: 72M/244M
2022-10-14T19:12:28.6323800Z INFO: ------------------------------------------------------------------------
2022-10-14T19:12:29.6897190Z ##[section]Finishing: SonarCloudAnalyze

Hi,

Thanks for this.

I notice a couple things. First:

You’re passing in the same report to two different parameters. It looks like one silently ignores it because it’s the wrong format.

Per the docs, sonar.swift.coverage.reportPaths accepts

Path to the report generated by llvm-cov show .

So here’s where the Generic Coverge sensor parses your report:

It reads the data, but ignores it because it can’t match the paths in your report to the files its seeing during analysis. Did you generate this report in a different file system that analysis is running in?

 
Ann

Hi Ann,
I am generating report on my mac system and analysis run on azure pipeline. Any idea how I can generate report using azure pipeline?

Yasir

Hi Yasir,

Sorry, that’s beyond me.

 
Ann

Hi,

I guess sonar didn’t not recognize your format for test coverage report or different problem. We are used settings below

  • task: Xcode@5
    displayName: ‘Clean Test’
    inputs:
    actions: ‘test’
    configuration: ‘Debug’
    sdk: ‘iphoneos’
    xcWorkspacePath: ‘ProjectName.xcworkspace’ **
    scheme: ‘ProjectSchemeName’ **
    xcodeVersion: ‘specifyPath’
    xcodeDeveloperDir: ‘/Applications/Xcode.app’
    packageApp: false
    args: ‘-enableCodeCoverage YES -derivedDataPath DerivedData’
    signingOption: ‘manual’
    signingIdentity: ‘$(APPLE_CERTIFICATE_SIGNING_IDENTITY)’
    provisioningProfileUuid: ‘$(APPLE_PROV_PROFILE_UUID)’
    useXcpretty: true
    publishJUnitResults: true
    testRunTitle: ‘TestRuntitle’ **
    destinationPlatformOption: ‘iOS’
    destinationTypeOption: ‘simulators’
    destinationSimulators: ‘iPhone 14’

Note: Please change ** with your project settings.

After that we convert from xcresult file to sonarqube-generic-coverage.xml format by using bash code in azure pipeline.

  • task: Bash@3
    inputs:
    targetType: ‘inline’
    script: ‘bash ./xccov-to-sonarqube-generic.sh /Users/kdogruer-mdm/myagent/_work/1/s/DerivedData/Logs/Test/*.xcresult/ > sonarqube-generic-coverage.xml’

Best Regards.

1 Like