Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/appsquickly/frankencover.it

Code coverage for iOS and OSX.
https://github.com/appsquickly/frankencover.it

code-coverage coverage coverage-report

Last synced: about 19 hours ago
JSON representation

Code coverage for iOS and OSX.

Awesome Lists containing this project

README

        

frankencover.it

Producing a test coverage report for iOS and OSX projects requires a mish-mash of tools and steps. Here we've glued them all together into something that (hopefully) just works.

* Generates a report with minimal steps.
* Outputs to the terminal as well as produces a detailed report in build-server friendly HTML format.
* Includes a coverage checker. This can be used in CI builds to check minimum test coverage - failing the build if coverage falls below the required amount.
* Free for both commercial and open-source projects.


# Installing

The script itself can be run remotely, but we'll first need to install dependencies . .

### With HomeBrew

```sh
brew install groovy
brew install lcov
```

### With MacPorts

```sh
sudo port install groovy
sudo port install lcov
```

# Important : Fixing 'Coverage Data Not Found' error

*NB:* Current version of Xcode requires bleeding edge lcov (`lcov --version`), not provided by MacPorts (need to confirm HomeBrew). To install:

```sh
git clone https://github.com/linux-test-project/lcov.git
cd lcov
sudo make install
```

# Usage

Set your main App target to produce test coverage output (debug mode only).

![Enable Coverage](http://appsquickly.github.io/frankencover.it/images/Coverage.png)

Set your main App target to instrument program flow (debug mode only).

![Enable Instrumentation](http://appsquickly.github.io/frankencover.it/images/Instrument.png)

### IDE Use

Run tests in your IDE (AppCode or Xcode) and produce a report with:

```sh
groovy http://appsquickly.github.io/frankencover.it/with -source-dir MyProject/Source
```

### Build server or cmd-line use

Create a build script as follows

```sh
# First Run Tests
xcodebuild test -workspace MyProject.xcworkspace/ -scheme 'MyProject' -configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 5s,OS=8.1' | xcpretty -c --report junit
#Above we are piping the build output through xcpretty, which is not required, but very nice.
#(gem install xcpretty)

# Now Produce Test Coverage Report
groovy http://appsquickly.github.io/frankencover.it/with -source-dir MyProject/Source -required-coverage 85
#Above we set required coverage to 85%. Build fails if coverage falls below this value.
```

. . this ensures using an update to date version.

# Output

#### cmd-line

![Output](http://appsquickly.github.io/frankencover.it/images/output.png)

#### browser

Report file is at `build/reports/coverage/index.html`.

![Browser](http://appsquickly.github.io/frankencover.it/images/report.png)

#### Cobertura Format

If you'd like to publish in Cobertura format (commonly supported by build servers) we recommend this Python script.

Place the script somewhere on visible to your build server or whatever needs cobertura format, and then execute as follows:

```sh
python ~/lcov_cobertura.py build/reports/coverage/data/coverage.info
```

#### Install locally

If you don't want to run the hosted script, it can be installed locally with:

```sh
curl -SSL http://appsquickly.github.io/frankencover.it/with > FrankenCover && chmod +x ./FrankenCover
```

# Swift Code Coverage

At the present time Swift Code coverage because the compiler currently ignores instructions to instrument the codebase. Please vote for this OpenRadar issue.

# Like this project?

frankencover.it is a non-profit, community driven project. We only ask that if you've found it useful to star us on Github or send a tweet mentioning us (@appsquickly). frankencover.it is sponsored and lead by appsquick.ly, with contributions from around the world.

## A big thank you to the following contributors:

* Alex Argo : Feedback & fixes for directories with unusual characters
* Hybrid Cat : Exclusions, html report configs.

## Contributing

For now, the script, along with documentation is located on the gh-pages branch.

# LICENSE

Apache License, Version 2.0, January 2004, http://www.apache.org/licenses/

* © 2014 Jasper Blues