XCoverage

Displays test coverage data in the text editor. If you don't currently generate gcov data, see github page for info on setting it up.


License
Apache-2.0

Documentation

XCoverage

Xcode Plugin that displays coverage data in the text editor

Example

Menu options:

Menu options

  • Quickly toggle with keyboard shortcut CMD+Shift+\
  • By default the plugin will try and find your coverage files, however for the best performance/reliability you can set your own location. The plugin will then use this location and recursively search it for your coverage file matching the source file you are viewing.

Installation instructions:

Install via Alcatraz

OR

Open the project in XCode and build it. This should auto-install it for you and just restart XCode to begin using!

To uninstall, delete the XCoverage directory from ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins

See test app for example

  • If you run the unit tests for the test app (CMD+U) then you will generate coverage data for the ViewController

Generating coverage data

This plugin does not actually generate coverage data for you, since there are various workflows that people use to do this. However if you don't currently have coverage data, the sample app includes some build scripts that can help you get started.

Steps:
1. Enable project settings to begin generating coverage information
2. Setup the export_build_vars.py script in build phases

This script is used to export any necessary environment variables from your latest build. The main reason this is needed is that many of the env variables at run-time are completely different in unrelated to your most recent build. They are also usually relative paths instead of absolute like these build variables.

Export build vars

3. Add pre-action script to the test section of your scheme

This script will clear any previous .gcda files from your target_object_dir, which helps ensure that this test run will be isolated in the coverage data.

Pre-action

4. Add post-action script to the test section of your scheme

This script will run gcov on all of your gcda files generated by your tests running in the app, generating .gcov files to be parsed by the plugin.

Post-action