Skip to content

Commit 9e63250

Browse files
committed
Improved scripts so you don't have to cd to XcodeCoverage folder first; run anywhere.
1 parent 3a0e642 commit 9e63250

File tree

5 files changed

+14
-24
lines changed

5 files changed

+14
-24
lines changed

README.md

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
These scripts provide a simple way to generate HTML reports of the code coverage
2-
of your Xcode 4.5 project.
3-
For a detailed blog post, see http://qualitycoding.org/xcode-code-coverage/
2+
of your Xcode project.
3+
For a detailed blog post, see http://qualitycoding.org/xcode-code-coverage/
4+
For additional steps needed to get code coverage in iOS 7, see http://qualitycoding.org/ios-7-code-coverage/
45

56

67
Installation
@@ -9,7 +10,7 @@ Installation
910
1. Fork this repository; you're probably going to want to make your own
1011
modifications.
1112
2. Place the XcodeCoverage folder in the same folder as your Xcode project.
12-
3. [Download lcov-1.10](http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz).
13+
3. [Dowload lcov-1.10](http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz).
1314
Place the lcov-1.10 folder inside the XcodeCoverage folder.
1415
4. Get Xcode's coverage instrumentation by going to Xcode Preferences, into Downloads, and installing Command Line Tools.
1516
5. In your Xcode project, enable these two build settings at the project level
@@ -27,14 +28,10 @@ Execution
2728
=========
2829

2930
1. Run your unit tests
30-
2. In Terminal, cd to your project's XcodeCoverage folder, then
31-
32-
$ ./getcov
31+
2. In Terminal, execute `getcov` your project's XcodeCoverage folder.
3332

3433
If you make changes to your test code without changing the production code and
35-
want a clean slate, use the ``cleancov`` script:
36-
37-
$ ./cleancov
34+
want a clean slate, use the ``cleancov`` script.
3835

3936
If you make changes to your production code, you should clear out all build
4037
artifacts before measuring code coverage again. "Clean Build Folder" by holding
@@ -49,14 +46,3 @@ There are two places you may want to modify:
4946
1. In envcov.sh, ``LCOV_INFO`` determines the name shown in the report.
5047
2. In getcov, edit ``exclude_data()`` to specify which files to exclude, for
5148
example, third-party libraries.
52-
53-
54-
More resources
55-
==============
56-
57-
* [Sources](https://github.com/jonreid/XcodeCoverage)
58-
* Testing tools: [OCHamcrest](https://github.com/hamcrest/OCHamcrest),
59-
[OCMockito](https://github.com/jonreid/OCMockito),
60-
[JMRTestTools](https://github.com/jonreid/JMRTestTools)
61-
* [Quality Coding](http://qualitycoding.org/) blog - Tools, tips & techniques
62-
for _building quality in_ to iOS development

cleancov

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Source: https://github.com/jonreid/XcodeCoverage
66
#
77

8-
source envcov.sh
8+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
source ${DIR}/envcov.sh
910

1011
"${LCOV}" --zerocounters -d "${OBJ_DIR}"

envcov.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
# Source: https://github.com/jonreid/XcodeCoverage
55
#
66

7-
source env.sh
7+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
source ${DIR}/env.sh
89

910
# Change the report name if you like:
1011
LCOV_INFO=Coverage.info

exportenv.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
# Source: https://github.com/jonreid/XcodeCoverage
55
#
66

7-
export | egrep '( BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > XcodeCoverage/env.sh
7+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
export | egrep '( BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > ${DIR}/env.sh

getcov

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
# Source: https://github.com/jonreid/XcodeCoverage
66
#
77

8-
source envcov.sh
8+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
source ${DIR}/envcov.sh
910

1011
remove_old_report()
1112
{

0 commit comments

Comments
 (0)