All Projects → jonreid → Xcodecoverage

jonreid / Xcodecoverage

Licence: mit
Code coverage for Xcode projects (Objective-C only)

Programming Languages

perl
6916 projects

Projects that are alternatives of or similar to Xcodecoverage

Imagecoordinatespace
UICoordinateSpace for UIImageView image
Stars: ✭ 42 (-94.87%)
Mutual labels:  xcode, coverage
Xcperfect
Make your xccov outputs prettier ✨
Stars: ✭ 56 (-93.15%)
Mutual labels:  xcode, coverage
Xcov
Nice code coverage reporting without hassle
Stars: ✭ 467 (-42.91%)
Mutual labels:  xcode, coverage
Peckham
Add #import-s from anywhere in the code.
Stars: ✭ 719 (-12.1%)
Mutual labels:  xcode
Wrap
The easy to use Swift JSON encoder
Stars: ✭ 725 (-11.37%)
Mutual labels:  xcode
Swiftui
A collaborative list of awesome SwiftUI resources. Feel free to contribute!
Stars: ✭ 774 (-5.38%)
Mutual labels:  xcode
Bfkit
BFKit is a collection of useful classes and categories to develop Apps faster.
Stars: ✭ 811 (-0.86%)
Mutual labels:  xcode
Gogradle
A Gradle Plugin Providing Full Support for Go
Stars: ✭ 712 (-12.96%)
Mutual labels:  coverage
Swiftkit
Start your next Open-Source Swift Framework 📦
Stars: ✭ 785 (-4.03%)
Mutual labels:  xcode
Ios Clean Architecture Mvvm
Template iOS app using Clean Architecture and MVVM. Includes DIContainer, FlowCoordinator, DTO, Response Caching and one of the views in SwiftUI
Stars: ✭ 753 (-7.95%)
Mutual labels:  xcode
Iconizer
Create Xcode asset catalogs swift and painless. Generate images for macOS and iOS app icons, launch images and image sets.
Stars: ✭ 751 (-8.19%)
Mutual labels:  xcode
Sonar Swift
Open source Swift plugin for SonarQube (also supports Objective-C)
Stars: ✭ 735 (-10.15%)
Mutual labels:  xcode
Makexcodegr8again
🔨 Xcode + Plugins = 💙
Stars: ✭ 775 (-5.26%)
Mutual labels:  xcode
Blockparty
Ad Blocker App for iOS, macOS
Stars: ✭ 722 (-11.74%)
Mutual labels:  xcode
Cyltabbarcontroller
[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
Stars: ✭ 6,605 (+707.46%)
Mutual labels:  xcode
Lucario
The best flat theme for Vim, Atom, Sublime Text, Jetbrains Editors, Terminal.app, iTerm, Xcode and XTerm
Stars: ✭ 711 (-13.08%)
Mutual labels:  xcode
Gravityslider
🔄 GravitySlider is a beautiful alternative to the standard UICollectionView flow layout.
Stars: ✭ 784 (-4.16%)
Mutual labels:  xcode
Font Awesome Swift
Font Awesome swift library for iOS.
Stars: ✭ 743 (-9.17%)
Mutual labels:  xcode
Xcodebenchmark
XcodeBenchmark measures the compilation time of a large codebase on iMac, MacBook, and Mac Pro
Stars: ✭ 736 (-10.02%)
Mutual labels:  xcode
Awesome Ios Interview
📲 The curated list of iOS Developer interview questions and answers, Swift & Objective-C
Stars: ✭ 753 (-7.95%)
Mutual labels:  xcode

XcodeCoverage

CocoaPods Version

XcodeCoverage provides a simple way to generate reports of the Objective-C code coverage of your Xcode project. Generated reports include HTML and Cobertura XML.

Coverage data excludes Apple's SDKs, and the exclusion rules can be customized.

Sadly, Swift coverage is not supported.

Installation: Standard

Use the standard installation if you want to customize XcodeCoverage to exclude certain files and directories, such as third-party libraries. Otherwise, the CocoaPods installation described below may be more convenient.

  1. Fork this repository.
  2. Place the XcodeCoverage folder in the same folder as your Xcode project.
  3. In your main target's Build Phases, add a Run Script build phase to execute XcodeCoverage/exportenv.sh

A few people have been tripped up by the last step: Make sure you add the script to your main target (your app or library), not your test target.

Installation: CocoaPods

A CocoaPod has been added for convenient use in simple projects. There are a couple of things you should be aware of if you are using the CocoaPod instead of the standard method:

  • There will be no actual files added to your project. Files are only added through preserve_paths, so they will be available in your Pods/XcodeCoverage path, but you will not see them in Xcode, and they will not be compiled by Xcode.
  • You will not be able to modify the scripts without those modifications being potentially overwritten by CocoaPods.

If those caveats are deal-breakers, please use the standard installation method above.

The steps to install via CocoaPods:

  1. Add pod 'XcodeCoverage', '~>1.0' (or whatever version specification you desire) to your Podfile.
  2. Run pod install. This will download the necessary files.
  3. In your main target, add a Run Script build phase to execute Pods/XcodeCoverage/exportenv.sh.

Again, make sure you add the script to your main target (your app or library), not your test target.

Xcode Project Setup

XcodeCoverage comes with an xcconfig file with the build settings required to instrument your code for coverage analysis.

If you already use an xcconfig, include it in the configuration you want to instrument:

  • Standard installation: #include "XcodeCoverage/XcodeCoverage.xcconfig"
  • CocoaPods installation: #include "Pods/XcodeCoverage/XcodeCoverage.xcconfig"

If you don't already use an xcconfig, drag XcodeCoverage.xcconfig into your project. Where it prompts "Add to targets," deselect all targets. (Otherwise, it will be included in the bundle.) Then click on your project in Xcode's Navigator pane, and select the Info tab. For the configuration you want to instrument, select XcodeCoverage.

If you'd rather specify the build settings by hand, enable these two settings at the project level:

  • Instrument Program Flow
  • Generate Legacy Test Coverage Files

Make sure not to instrument your AppStore release.

Execution

  1. Run your unit tests.
  2. In Terminal, execute getcov in your project's XcodeCoverage folder.

getcov has the following command-line options:

  • --show or -s: Show HTML report.
  • --xml or -x: Generate Cobertura XML.
  • -o output_dir: Specify output directory.
  • -i info_file: Specify name of generated lcov info file.
  • -v: Enable verbose output.
  • -h or --help: Show usage.

If you make changes to your test code without changing the production code and want a clean slate, use the cleancov script.

If you make changes to your production code, you should clear out all build artifacts before measuring code coverage again. "Clean Build Folder" by holding down the Option key in Xcode's "Product" menu, or by using the ⌥⇧⌘K key combination.

Optional: XcodeCoverage can prompt to run code coverage after running unit tests:

  • Edit Xcode scheme -> Test -> Post-actions
  • Set "Shell" to: /bin/bash
  • Set "Provide build settings from" to your main target
  • Set script to source XcodeCoverage/run_code_coverage_post.sh for standard installation. For CocoaPods installation, use source Pods/XcodeCoverage/run_code_coverage_post.sh

Excluding Files From Coverage

If there are files or folders which you want to have the coverage generator ignore (for instance, third-party libraries not installed via CocoaPods or machine-generated files), add an .xcodecoverageignore file to your SRCROOT.

Each line should be a different file or group of files which should be excluded for code coverage purposes. You can use SRCROOT relative paths as well as the * character to indicate everything below a certain directory should be excluded.

Example contents of an .xcodecoverageignore file:

${SRCROOT}/TestedProject/Machine Files/*
${SRCROOT}/TestedProject/Third-Party/SingleFile.m
${SRCROOT}/TestedProject/Categories/UIImage+IgnoreMe.{h,m}

Note: If you were using a version of XcodeCoverage prior to 1.3, you will need to move the list of files and folders you wish to ignore to the .xcodecoverageignore file. The current setup will prevent your customized list from being overwritten when there is an update to this project.

Credits

The lcov -> Cobertura script is from https://github.com/eriwen/lcov-to-cobertura-xml/ and is bound by the license of that project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].