How to get code coverage in Xcode 6?

最后都变了- 提交于 2019-12-03 04:52:21

问题


My tests are XCTests and I'm using Objective-C instead of Swift.

I've seen some articles that tackle the topic, but the seem focused on older versions of Xcode, for example:

  • Visualizing Code Coverage with Xcode
  • Code Coverage Fixed for Xcode 5.1

What would be the recommended approach to get code coverage on Xcode 6? Does Apple have something built in for code coverage, maybe via Xcode CI via OSX Server?


回答1:


Take a look at frankencover.it

  • Simple script that can be run from dev's cmd-line or CI build server.
  • Produces console output as well as a detailed report in HTML format. This can be viewed locally or published as an artifact by the build server.
  • Optionally includes a checker that will 'fail' the build if required coverage is not met. (Feedback only. This is a prompt to review coverage and look for useful tests that can be added or reduce the required amount. Either option may be correct. )
  • Free for both commercial and open-source projects. No hosting, sponsorship or subscription required.

Usage:

FTW, it has an easy-to-remember dogue-speak-esque command line interface:

groovy http://appsquickly.github.io/frankencover.it/with --source-dir MyProject/Source

Terminal Output:

HTML Report:




回答2:


We use Xcoverage for this..Check on link below, if this helps..

Xcoverage




回答3:


This is an update, From Xcode 6 Apple having in-build code coverage tool, But Have a look at coverStory it is easy to configure test locally before push. And providing a line by line coverage.



来源:https://stackoverflow.com/questions/25774163/how-to-get-code-coverage-in-xcode-6

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