Skip to content

Commit 1e40d4b

Browse files
README Updates
- Added information about CocoaPods option - Updated double-ticked inline code to use single-ticked - Pulled everything onto continuous lines.
1 parent b614d6e commit 1e40d4b

File tree

1 file changed

+49
-29
lines changed

1 file changed

+49
-29
lines changed

README.md

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,76 @@
11
![XcodeCoverage](http://qualitycoding.org/jrwp/wp-content/uploads/2014/03/XcodeCoverage.png)
22

3-
These scripts provide a simple way to generate HTML reports of the code coverage
4-
of your Xcode project.
3+
These scripts provide a simple way to generate HTML reports of the code coverage of your Xcode project.
54

65

7-
Installation
8-
============
6+
Xcode Project Setup
7+
===================
8+
9+
Before you get started, there are a couple of steps you will need to take to prepare your project:
10+
11+
1. Depending on your version of Xcode, you may need to get Xcode's coverage instrumentation by going to Xcode > Preferences, into Downloads, and installing Command Line Tools. If you do not see this as an option in the Downloads section, the tools should already be installed.
12+
4. In your Xcode project, enable these two build settings at the project level for your Debug configuration only:
13+
* Instrument Program Flow
14+
* Generate Test Coverage Files
15+
916

10-
1. Fork this repository; you're probably going to want to make your own
11-
modifications.
17+
Installation: Standard
18+
======================
19+
20+
1. Fork this repository; you're probably going to want to make your own modifications.
1221
2. Place the XcodeCoverage folder in the same folder as your Xcode project.
13-
3. Depending on your version of Xcode, you may need to get Xcode's coverage
14-
instrumentation by going to Xcode Preferences, into Downloads, and installing
15-
Command Line Tools.
16-
4. In your Xcode project, enable these two build settings at the project level
17-
for your Debug configuration only:
18-
* Instrument Program Flow
19-
* Generate Test Coverage Files
20-
5. In your main target, add a Run Script build phase to execute
21-
``XcodeCoverage/exportenv.sh``
22+
5. In your main target, add a Run Script build phase to execute `XcodeCoverage/exportenv.sh`
23+
24+
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.
25+
26+
27+
Installation: CocoaPods
28+
=======================
2229

23-
A few people have been tripped up by the last step: Make sure you add the
24-
script to your main target (your app or library), not your test target.
30+
A [CocoaPod](http://cocoapods.org/) 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:
31+
32+
- 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.
33+
- You will not be able to modify the scripts without those modifications being potentially overwritten by CocoaPods.
34+
35+
If those caveats are deal-breakers, please use the standard installation method above.
36+
37+
The steps to install via CocoaPods:
38+
39+
1. Add `pod 'XcodeCoverage', '~>1.0'` (or whatever [version specification](http://guides.cocoapods.org/using/the-podfile.html#specifying-pod-versions) you desire) to your Podfile.
40+
2. Run `pod install`. This will download the necessary files.
41+
3. In your main target, add a Run Script build phase to execute
42+
`Pods/XcodeCoverage/exportenv.sh`.
43+
44+
Again, make sure you add the script to your main target (your app or library), not your test target.
2545

2646

2747
Execution
2848
=========
2949

30-
1. Run your unit tests
50+
Immediately after installation, run your application at least once to generate the `env.sh` file, which will be placed at the same level as your `.xcodeproj` folder. This file should *not* be checked into version control, since it contains paths local to your machine.
51+
52+
Once that task has been completed, the process is very simple:
53+
54+
1. Run your unit tests.
3155
2. In Terminal, execute `getcov` in your project's XcodeCoverage folder.
3256

33-
If you make changes to your test code without changing the production code and
34-
want a clean slate, use the ``cleancov`` script.
57+
If you make changes to your test code without changing the production code and want a clean slate, use the `cleancov` script.
3558

3659
If you make changes to your production code, you should clear out all build
37-
artifacts before measuring code coverage again. "Clean Build Folder" by holding
38-
down the Option key in Xcode's "Product" menu.
60+
artifacts before measuring code coverage again. "Clean Build Folder" by holding down the Option key in Xcode's "Product" menu.
3961

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

4264
* Edit Xcode scheme -> Test -> Post-actions
43-
* Set "Shell" to: ``/bin/bash``
65+
* Set "Shell" to: `/bin/bash`
4466
* Set "Provide build settings from" to your main target
45-
* Set script to:
46-
``source ${SRCROOT}/XcodeCoverage/run_code_coverage_post.sh``
67+
* Set script to: `source ${SRCROOT}/XcodeCoverage/run_code_coverage_post.sh`
4768

4869

4970
Modification
5071
============
5172

52-
There are two places you may want to modify:
73+
There are two places you may want to modify the included files if you are using the standard installation:
5374

54-
1. In envcov.sh, ``LCOV_INFO`` determines the name shown in the report.
55-
2. In getcov, edit ``exclude_data()`` to specify which files to exclude, for
56-
example, third-party libraries.
75+
1. In `envcov.sh`, `LCOV_INFO` determines the name shown in the report.
76+
2. In `getcov`, edit `exclude_data()` to specify which files to exclude, for example, third-party libraries.

0 commit comments

Comments
 (0)