http://www.infinite-loop.dk/blog/
需要测试代码覆盖率的问题
This tutorial is just a small follow-up on one of my earlier posts about how to set up code coverage in Xcode.
With the release of Xcode 4.2 code coverage is finally supported using Clang / LLVM. Opposed to what I described in the earlier post you no longer need to force the use of GCC to get code coverage metrics in your unit tests. Since Apple has also decided to drop support for GCC you are more or less forced to switch to Clang / LLVM anyway.
In Xcode 4.2 it’s fairly simple to set up code coverage. If you have defined a custom build setting or build rule that enforces GCC 4.2 you will need to remove those first.
Next you’ll need to enable the two build settings “Generate Test Coverage Files” and “Instrument Program Flow” as shown below:
Introduction
CoverStory is a GUI tool for analyzing which lines of your code have actually been executed when you run you test your code. It requires a little set up to use effectively, you must make some target changes in your Xcode project.
Project Settings
Xcode 4.3 with LLVM Compiler
Unfortunately it appears that code coverage is broken again for iOS using llvm. libprofile_rt has not been compiled with i386, and doesn't even appear in the iOS SDK.
Xcode 4.2 with LLVM Compiler
With Xcode 4.2 (4C139 aka iOS 5 beta 4) code coverage appears to be working with LLVM. To get it working you need to do the following:
- Add -fprofile-arcs and -ftest-coverage to Other C Flags
- Link /Developer/usr/lib/libprofile_rt.dylib into your app
- Build and run

本文介绍如何在Xcode 4.2中使用Clang/LLVM进行代码覆盖率测试。教程覆盖了从配置编译参数到运行测试的具体步骤,并提供了必要的链接资源。

1660

被折叠的 条评论
为什么被折叠?



