2003
01 02 03 04 05 06 07 08 09 10 11 12
2010
01 02 03 04 05 06 07 08 09 10 11 12
2011
01 02 03 04 05 06 07 08 09 10 11 12
2016
01 02 03 04 05 06 07 08 09 10 11 12
2017
01 02 03 04 05 06 07 08 09 10 11 12
 
Mar
27
2011

Code Coverage with Bamboo and Xcode 3

Setup Code Coverage and Bamboo

To setup the coverage test with Xcode, use gcc and follow the instructions here and here. (Sadly, llvm doesn’t support gcov compatible result yet.)

If you like to use Bamboo to do Continuous Integration for xcode project, be sure to check the setup in this article for Hudson: it’s almost the same for Bamboo. You may find it helpful installing git plugin and Cobertura plugin first. Basically, you’ll build project using xcodebuild command-line tool on target that have coverage option enabled, convert the gcov result to Cobertura XML format using gcovr, and feed it to Bamboo Cobertura plugin.

Zero Code Coverage?

After finishing all the setup, you may find that the Cobertura plugin always reports zero code coverage. Zero! Frightening, huh? That’s because the xml file generated by gcovr script is not completely confirmed to cobertura DTD: Cobertura plugin expect the root “coverage” node have “line-rate” and “branch-rate” attribute.

Fix

I’ve patched the gcovr script so that it add these two attribute to root node. It’s not completely confirmed to cobertura DTD yet, but at least it works with Cobertura plugin for Bamboo.

You could grab my patched version here.

I also open a ticket to gcovr team.

 
 

Write Concisely