Code Coverage GCov not working with XCode 4.2 and iOS SDK 5

后端 未结 2 508
半阙折子戏
半阙折子戏 2021-01-22 04:07

I\'ve been trying to get GCov working with Xcode 4.2Build 4D199 on Lion with iOS SDK 5.0 to no avail. Has anyone had any luck with this? I\'m using Google Tools For Mac for my u

2条回答
  •  离开以前
    2021-01-22 04:37

    How to generate coverage test reports (Xcode 4.5 edition)

    1. cd to your Xcode project and type

      git clone git@github.com:j4n0/XcodeCoverage.git
      cd XcodeCoverage
      wget http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz
      tar -zxvf lcov-1.10.tar.gz
      
    2. Set the following build properties on both your main target and your SentestKit target, but only for the Debug configuration (expand the node, there are Debug and Release entries):

      Generate Profiling code       Yes
      Generate Test Coverage Files  Yes
      Instrument Program Flow       Yes
      
    3. Install Xcode command line tools: Xcode > Preferences > Downloads > Command Line Tools.

    4. In your main target, add a “Run Script” build phase to execute ./XcodeCoverage/exportenv.sh

    5. Build your application, and run the tests.

    6. Generate the coverage report from the XcodeCoverage typing: ./getcov
      Upon completion, the script will launch a browser with the html output.

    If reports are not generated try this:

    • Edit the plist of your application and add the following:
      UIApplicationExitsOnSuspend
      
      
      Then run your application and press Home. This will quit cleanly and generate the gcda files.
    • If it still doesn't work, try using the iPad simulator instead.

    For more tips and tricks check the talk Code Coverage on iOS by Richard Buckle.

提交回复
热议问题