Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mgrebenets/mixandmatchtests
Example of Unit Tests for Mix-n-Match Project
https://github.com/mgrebenets/mixandmatchtests
Last synced: 2 months ago
JSON representation
Example of Unit Tests for Mix-n-Match Project
- Host: GitHub
- URL: https://github.com/mgrebenets/mixandmatchtests
- Owner: mgrebenets
- Created: 2015-09-21T12:24:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-17T04:58:18.000Z (almost 9 years ago)
- Last Synced: 2023-03-22T18:54:46.780Z (almost 2 years ago)
- Language: Objective-C
- Size: 29.3 KB
- Stars: 20
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Code Coverage Reports for Xcode Project
===
_Mix and match containing both Objective-C and Swift_[![CI Status](http://img.shields.io/travis/mgrebenets/MixAndMatchTests.svg?style=flat)](https://travis-ci.org/mgrebenets/MixAndMatchTests)
[![codecov.io](http://codecov.io/github/mgrebenets/MixAndMatchTests/coverage.svg?branch=master)](http://codecov.io/github/mgrebenets/MixAndMatchTests?branch=master)This is a sample repository that demonstrates getting the code coverage reports out of Xocde using command line.
See [this blog post](http://mgrebenets.github.io/mobile%20ci/2015/09/21/code-coverage-for-ios-xcode-7/) for more details.
# Switching Xcode
If you want to experiment with both Xcode 6 and 7, make sure you switch Xcode version.
For temporary effect that applies to current shell session only, use `DEVELOPER_DIR` environment variable.```bash
# Default
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer# Some other
export DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer
```# Pre-requisites
Install `gcovr` and `lcov` tools.```bash
brew install gcovr lcov
```Install custom version of Slather ruby gem.
```bash
# Will use Gemfile
bundle install
```# Scripts
## test-gcov.sh
Run `test` action with proper build settings to enable app instrumentation and generation of coverage data.If you want to use unit tests scheme, set `TESTS_TARGET` variable to "YES". This may be useful in advanced setup where you want to redefine `TEST_HOST` build setting as well.
```bash
# Run tests using Test action of default target
./test-gcov.sh# Run tests using Test action of
TESTS_TARGET=YES ./test-gcov.sh
```## gcovr.sh
This script will use `gcovr` tool to collect test coverage information from build directory and output it as Cobertura-compatible coverage report XML named `gcov-report.xml`.## lcov.sh
This script will use `lcov` utility to collect test coverage information and output it as HTML report.## test-profdata.sh
This script will run the tests using new `-enableCodeCoverage` option of `xcodebuild`. Requires Xcode 7 or newer.## slather.sh
Collect code coverage data in Profdata format and convert to gcov format (Cobertura-compatible). Output is saved to `slather-report` folder.