Archive for March 27th, 2012

Code coverage for iOS testing with OCUnit

I recently posted steps for setting up iOS unit testing with Jenkins, but working on a new project realized I wanted to take this a step further and start seeing code coverage metrics. The configuration has evolved quite a bit but fortunately there’s a great Code Coverage with Xcode 4.2 guide from Infinite Loop that covers this and seems to work with both Xcode 4.3 and 4.4 in my testing. Be sure to check the included links, related posts, and followup in comments for troubleshooting various errors that creep up across different Xcode versions. Once tests have been run against instrumented code you can view the coverage output graphically in CoverStory on a Mac. Finally, if you want to convert this output to Cobertura-style for display in Jenkins using gcovr you’ll want to configure your Jenkins build as described inĀ iOS Code Coverage, Cobertura and Jenkins. Good stuff!

, ,

1 Comment