Beruflich Dokumente
Kultur Dokumente
Richard Buckle
Sailmaker Systems Ltd
Tuesday, 2 October 12
Tuesday, 2 October 12
Dead code?
Tuesday, 2 October 12
Tuesday, 2 October 12
Tuesday, 2 October 12
10
Tuesday, 2 October 12
11
Tuesday, 2 October 12
12
Tuesday, 2 October 12
13
So how do I actually do
this?
Tuesday, 2 October 12
14
Tuesday, 2 October 12
15
Tuesday, 2 October 12
16
open ${OBJECT_FILE_DIR_normal}
Ill come back to taming Xcode later
Tuesday, 2 October 12
17
Tuesday, 2 October 12
18
gcov
Fine if you like working at such a low level
man gcov
Can do pretty much anything you want
Tuesday, 2 October 12
19
CoverStory
Apache Licence 2.0
http://code.google.com/p/coverstory/
Scriptable, can emit customisable HTML
Probably the easiest for most people
Best option for interactive use
Its icon is different
Tuesday, 2 October 12
20
Non-feasible code
CoverStory supports marking of nonfeasible code via comments, such as:
Sanity checks
Branching based on runtime platform
http://code.google.com/p/coverstory/wiki/
NonFeasibleCode
21
Shell script
Tuesday, 2 October 12
22
Python
gcovr from https://software.sandia.gov/
trac/fast/downloader
23
Taming Xcodes
Coverage tools
Yes, it can be done, on both simulator and
devices!
Tuesday, 2 October 12
24
Thats all!
Tuesday, 2 October 12
25
Running Manually
Tuesday, 2 October 12
26
A small problem
Coverage data is only emitted when the
app exits cleanly
27
Two solutions
Have the coverage config opt out of
backgrounding
Tuesday, 2 October 12
28
<key>UIApplicationExitsOnSuspend</key>
#ifdef GCOV
<true/>
#else
<false/>
#endif
Tuesday, 2 October 12
29
Backdoor exit UI
Define a preprocessor macro for the
#if GCOV
exit(0);
#endif
Tuesday, 2 October 12
30
Tuesday, 2 October 12
<http://gcc.gnu.org/onlinedocs/gcc/Cross_002dprofiling.html>
31
!
!
!
}
@autoreleasepool {
! int retVal = UIApplicationMain(argc, argv, nil, nil);
! return retVal;
}
Tuesday, 2 October 12
32
Difficult to automate
unfortunately
Tuesday, 2 October 12
33
34
Jenkins integration
Build the project in the usual way, making sure the tests
run:
xcodebuild -sdk iphonesimulator -project
MyProject.xcodeproj -target MyProjectTests
-configuration Debug clean build
TEST_AFTER_BUILD=YES
Tuesday, 2 October 12
35
General References
Martin Fowler
http://martinfowler.com/bliki/TestCoverage.html
Brian Marick
http://www.exampler.com/testing-com/writings/
coverage.pdf
http://www.developertesting.com/archives/
month200705/20070504-000425.html
Tuesday, 2 October 12
36
Xcode references
Tuesday, 2 October 12
http://jonboydell.blogspot.ch/2012/06/xcode-43-and-jenkinscode-test-coverage.html
http://blog.octo.com/en/jenkins-quality-dashboard-iosdevelopment/
http://blog.octo.com/en/ios-development-right-code-coverage/
37
Q&A
richardb@sailmaker.co.uk
Twitter @RichardBuckle
app.net @RichardBuckle
Tuesday, 2 October 12
38