Xcode 4.4.1上的代码覆盖率 [英] Code Coverage on Xcode 4.4.1

查看:88
本文介绍了Xcode 4.4.1上的代码覆盖率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在Xcode4.4.1上为Mac应用程序进行代码覆盖测试,该应用程序是10.8应用程序,因此应用程序仅通过Xcode4.4.1构建和运行。但是在使用Xcode4.4.1时找不到/Developer/usr/lib/libprofile_rt.dylib库。是否还有更好的工具来运行Xcode4.4.1上的代码覆盖?

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 ?

寻找一些代码覆盖工具,适用于Xcode4.4.1上的mac和iOS应用程序

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

推荐答案

不需要包含* libprofile_rt.dylib *并在xCode 4.4.1中运行项目时使用* -profile_rt *标志(与iOS模拟器一样使用魅力)只需设置这些标志:

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

构建并运行。如果您破坏了应用程序的测试目标,* .gcda文件会自动创建,因为经过测试的应用程序终止,如果运行常规目标,则在您明确终止应用程序时会创建* .gcda文件(另一种方法是设置 UIApplicationExitsOnSuspend = YES in .plist)

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)

请注意,它在使用xCode 4.4.1创建的新项目上经过了充分测试

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

这篇关于Xcode 4.4.1上的代码覆盖率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆