Continuous Integration and Code Coverage

Joshua Moody edited this page Mar 9, 2017 · 3 revisions

This page is maintained by the community.

Given the variety of CI systems and the complexity of administering them, it is not feasible for us to provide support or recommendations. We use Jenkins and Travis CI to test the Calabash iOS Toolchain. If you are interested to see how we do it, have a look at the scripts in these repositories:

Alex Denisov's build and execute

Jenkins

Setup Jenkins to run the iOS Simulator (possibly also Unit tests)

by Manuel Binna

http://9elements.com/io/index.php/continuous-integration-of-ios-projects-using-jenkins-cocoapods-and-kiwi/

Password Prompt Elimination

Issues with 'Developer Tools needs access ...' prompt

Jenkins+launchd

https://groups.google.com/d/msg/calabash-ios/PFafk2ca_cw/leapJzO5rHwJ

Code Coverage

Credit! This notes are due to Trevor Harmon (@vocaro) - thanks alot!

Make sure you are running Xcode 4.6 or above. Previous versions had a Gcov bug in Clang.

• In the project’s Build Settings, change the following options:

Generate Test Coverage Files = Yes
Instrument Program Flow = Yes

This will generate Gcov notes files (*.gcno) when the program is built.

• Gcov will not write all of the output data for coverage analysis unless the app exits cleanly. (Quitting the iOS Simulator kills the app and does not allow it to exit cleanly.) To exit the app cleanly at the end of each scenario, add the following to your app’s Calabash launch file (launch.rb):

After do |scenario|
    calabash_exit
end

• After the tests run, Gcov data files (*.gcda) will appear alongside the notes files in the app’s build directory. They can be analyzed with a tool such as CoverStory (http://code.google.com/p/coverstory/) or gcovr (https://software.sandia.gov/trac/fast/wiki/gcovr). Here is a script I use to generate a simple report using gcovr:

#!/bin/sh
set -ex
DERIVED_DATA_DIRECTORY=`cut -d "=" -f 2 cucumber.yml | sed 's:/Build/Products/Test-iphonesimulator/YOURAPP.app::'`
OBJECT_DIRECTORY=$DERIVED_DATA_DIRECTORY/Build/Intermediates/YOURAPP.build/Test-iphonesimulator/YOURAPP.build/Objects-normal/i386
gcovr/gcovr -r $PWD/../.. -e Libs/* $OBJECT_DIRECTORY

Replace YOURAPP with your app and modify as necessary.

Another nice thing about gcovr is that it can generate XML data consumable by Cobertura, which generates very nice HTML coverage reports and has a Jenkins plugin.

Feel free to add any of this to the wiki.

Trevor

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.