Skip to main content
All CollectionsKnowledge BaseGeneral issues
Can't find code coverage files produced by Xcode Test for iOS Step
Can't find code coverage files produced by Xcode Test for iOS Step
Updated over a week ago

Issue:

The input variable Generate code coverage files? is set to yes but I can't find the files.

Possible solutions:

The flags that are being used with the current input variable Generate code coverage files? are outdated. We have a ticket open to address this issue and update the Step.

In the meantime, you can use the following to generate these files:

  • Do not use generate_code_coverage_files. Make sure the value for this input is no.

  • Use xcodebuild_test_options to turn on coverage report generation by specifying: -enableCodeCoverage YES

  • Add a Script Step which can be used to view the coverage report:

    - script:
        inputs:
        - content: |-
            #!/bin/env bash
            set -ex
            # line coverage percentages for each target, source file, and function/method that has coverage information
            xcrun xccov view --report $BITRISE_XCRESULT_PATH            # get the list of files from result bundle
            xcrun xccov view --archive --file-list  $BITRISE_XCRESULT_PATH            # get line coverage for a given file
            xcrun xccov view --archive --file "$BITRISE_SOURCE_DIR/_tmp/ios-simple-objc/ios-simple-objc/ViewController.m" $BITRISE_XCRESULT_PATH 

The script contains 3 different calls to xcrun xccov viewcalls:

  1. The first call prints the coverage percentage for all targets.

  2. The second call prints all the available files.

  3. The third call prints coverage for a given file.

Did this answer your question?