- Update
This commit is contained in:
1 parent
d281d765ea
commit
5b074a5176
1261 files changed
+199158
-7303
No files matched your search
@@ -0,0 +1,2 @@
|
||||
env.sh
|
||||
lcov-*
|
||||
@@ -0,0 +1,21 @@
|
||||
Copyright 2012 Jonathan M. Reid
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
(MIT License)
|
||||
@@ -0,0 +1,59 @@
|
||||
These scripts provide a simple way to generate HTML reports of the code coverage
|
||||
of your Xcode 4.5 project.
|
||||
For a detailed blog post, see http://qualitycoding.org/xcode-code-coverage/
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
1. Fork this repository; you're probably going to want to make your own
|
||||
modifications.
|
||||
2. Place the XcodeCoverage folder in the same folder as your Xcode project.
|
||||
3. [Dowload lcov-1.10](http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz).
|
||||
Place the lcov-1.10 folder inside the XcodeCoverage folder.
|
||||
4. Get Xcode's coverage instrumentation by going to Xcode Preferences, into Downloads, and installing Command Line Tools.
|
||||
5. In your Xcode project, enable these two build settings at the project level
|
||||
for your Debug configuration only:
|
||||
* Instrument Program Flow
|
||||
* Generate Test Coverage Files
|
||||
6. In your main target, add a Run Script build phase to execute
|
||||
``XcodeCoverage/exportenv.sh``
|
||||
|
||||
|
||||
Execution
|
||||
=========
|
||||
|
||||
1. Run your unit tests
|
||||
2. In Terminal, cd to your project's XcodeCoverage folder, then
|
||||
|
||||
$ ./getcov
|
||||
|
||||
If you make changes to your test code without changing the production code and
|
||||
want a clean slate, use the ``cleancov`` script:
|
||||
|
||||
$ ./cleancov
|
||||
|
||||
If you make changes to your production code, you should clear out all build
|
||||
artifacts before measuring code coverage again. "Clean Build Folder" by holding
|
||||
down the Option key in Xcode's "Product" menu.
|
||||
|
||||
|
||||
Modification
|
||||
============
|
||||
|
||||
There are two places you may want to modify:
|
||||
|
||||
1. In envcov.sh, ``LCOV_INFO`` determines the name shown in the report.
|
||||
2. In getcov, edit ``exclude_data()`` to specify which files to exclude, for
|
||||
example, third-party libraries.
|
||||
|
||||
|
||||
More resources
|
||||
==============
|
||||
|
||||
* [Sources](https://github.com/jonreid/XcodeCoverage)
|
||||
* Testing tools: [OCHamcrest](https://github.com/hamcrest/OCHamcrest),
|
||||
[OCMockito](https://github.com/jonreid/OCMockito),
|
||||
[JMRTestTools](https://github.com/jonreid/JMRTestTools)
|
||||
* [Quality Coding](http://qualitycoding.org/) blog - Tools, tips & techniques
|
||||
for _building quality in_ to iOS development
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
|
||||
# Created by: Jon Reid, http://qualitycoding.org/
|
||||
# Source: https://github.com/jonreid/XcodeCoverage
|
||||
#
|
||||
|
||||
source envcov.sh
|
||||
|
||||
"${LCOV_PATH}/lcov" -d "${OBJ_DIR}" --zerocounters
|
||||
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
|
||||
# Created by: Jon Reid, http://qualitycoding.org/
|
||||
# Source: https://github.com/jonreid/XcodeCoverage
|
||||
#
|
||||
|
||||
source env.sh
|
||||
|
||||
# Change the report name if you like:
|
||||
LCOV_INFO=Coverage.info
|
||||
|
||||
LCOV_PATH=${SRCROOT}/XcodeCoverage/lcov-1.10/bin
|
||||
OBJ_DIR=${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
|
||||
# Created by: Jon Reid, http://qualitycoding.org/
|
||||
# Source: https://github.com/jonreid/XcodeCoverage
|
||||
#
|
||||
|
||||
export | egrep '( BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > XcodeCoverage/env.sh
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
|
||||
# Created by: Jon Reid, http://qualitycoding.org/
|
||||
# Source: https://github.com/jonreid/XcodeCoverage
|
||||
#
|
||||
|
||||
source envcov.sh
|
||||
|
||||
remove_old_report()
|
||||
{
|
||||
pushd ${BUILT_PRODUCTS_DIR}
|
||||
if [ -e lcov ]; then
|
||||
rm -r lcov
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
||||
enter_lcov_dir()
|
||||
{
|
||||
cd ${BUILT_PRODUCTS_DIR}
|
||||
mkdir lcov
|
||||
cd lcov
|
||||
}
|
||||
|
||||
gather_coverage()
|
||||
{
|
||||
"${LCOV_PATH}/lcov" -b "${SRCROOT}" -d "${OBJ_DIR}" --capture -o ${LCOV_INFO}
|
||||
}
|
||||
|
||||
exclude_data()
|
||||
{
|
||||
"${LCOV_PATH}/lcov" -d "${OBJ_DIR}" --remove ${LCOV_INFO} "/Applications/Xcode.app/*" -o ${LCOV_INFO}
|
||||
"${LCOV_PATH}/lcov" -d "${OBJ_DIR}" --remove ${LCOV_INFO} "main.m" -o ${LCOV_INFO}
|
||||
# Remove other patterns here...
|
||||
}
|
||||
|
||||
generate_report()
|
||||
{
|
||||
"${LCOV_PATH}/genhtml" --output-directory . ${LCOV_INFO}
|
||||
open index.html
|
||||
}
|
||||
|
||||
remove_old_report
|
||||
enter_lcov_dir
|
||||
gather_coverage
|
||||
exclude_data
|
||||
generate_report
|
||||
Reference in new issue
Block a user