Code Coverage on Xcode 4.4.1

吃可爱长大的小学妹 提交于 2019-12-01 06:09:34

问题


I've been trying code coverage testing for Mac application on Xcode4.4.1, and the app is an 10.8 app so the app builds and runs only via Xcode4.4.1. But the /Developer/usr/lib/libprofile_rt.dylib library is not found while using Xcode4.4.1. Is there anyway or better tool to run Code coverage on Xcode4.4.1 ?

Looking for some code coverage tool to work for both mac and iOS app on Xcode4.4.1


回答1:


You don't need to include *libprofile_rt.dylib* and use *-profile_rt* flag when running project in xCode 4.4.1 (works with iOS Simulator like a charm) Just set these flags:

Generate Test Coverage Files: YES
Instrument Program Flow: YES

Build and run. In case you runt Test-target of your app, *.gcda files are created automatically because tested app terminates, in case of running regular target, *.gcda files are created when you explicitly kill your app (the other approach is to set UIApplicationExitsOnSuspend = YES in .plist)

Please note, it was well tested on new project created with xCode 4.4.1




回答2:


You just need to set the following in Build Settings:
Generate Test Coverage Files: YES
Instrument Program Flow: YES

The .gcda files will only be output when the app exits so, for iOS builds, you should set 'UIApplicationExitsOnSuspend' to YES in the Info.plist.

Code coverage files will be output to <derived data>/Build/Intermediates/.build/<configuration>/<targetName>.build/Objects-normal/i386




回答3:


Seems like Code coverage using LLVM and CoverStrory is broken in Xocde4.4.1 ,

https://devforums.apple.com/message/717814#717814 - Is the link in apple dev forum discussing this issue.



来源:https://stackoverflow.com/questions/12055085/code-coverage-on-xcode-4-4-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!