简体   繁体   English

如何获取iOS的代码覆盖率数据?

[英]How can I get code coverage data for iOS?

I'd like to see code coverage data for an iOS project. 我想查看iOS项目的代码覆盖率数据。

Apparently it used to be possible using gcov but using Xcode 4.5 does not result in any gcda files. 显然以前使用gcov可以实现,但是使用Xcode 4.5不会产生任何gcda文件。

Do you know of any tutorials or solutions on how to get such data using the latest Xcode 4.5.1? 您是否了解有关如何使用最新的Xcode 4.5.1获取此类数据的任何教程或解决方案?

Thank you 谢谢

Set the following flags in your unit test target: 在单元测试目标中设置以下标志:

Generate Test Coverage Files and Instrument Program Flow Generate Test Coverage FilesInstrument Program Flow

to yes . yes

As far as I remember there will only be coverage files if the unit test pass. 据我记得,只有单元测试通过,才会有覆盖率文件。
You will find the coverage files in .../Derived Data/Your App/Intermediates/Your App.build/Objects-normal/i386 您可以在.../Derived Data/Your App/Intermediates/Your App.build/Objects-normal/i386找到覆盖率文件

I went to an excellent presentation on Code coverage in Xcode at our Regular London iOS Developer Group Meeting. 在我们定期的伦敦iOS开发者小组会议上,我参加了关于Xcode代码覆盖率的精彩演讲。

You can get the slides from Lanyrd . 您可以从Lanyrd获取幻灯片。

If I recall correctly, it's actually easier with the newer Xcode. 如果我没记错的话,使用更新的Xcode实际上会更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM