如何在Xcode 6中获得代码覆盖率? [英] How to get code coverage in Xcode 6?

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

问题描述

我的测试是XCTests,我使用的是Objective-C而不是Swift。

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

我见过一些解决这个话题的文章,但似乎主要关注旧版本的Xcode,例如:

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

在Xcode 6上获取代码覆盖率的推荐方法是什么? Apple是否有代码覆盖内置的东西,可能是通过OSX Server通过Xcode CI?

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?

推荐答案

看看 frankencover.it


  • 可以从dev的cmd-line或CI构建服务器运行的简单脚本。

  • 生成控制台输出以及HTML格式的详细报告。这可以在本地查看,也可以由构建服务器作为工件发布。

  • 可选择包括一个检查器,如果不满足所需的覆盖范围,它将使构建失败。 (仅反馈。这是审查覆盖范围的提示,并寻找可以添加 减少所需金额的有用测试。这两个选项都可能是正确的。)

  • 免费提供商业和开源项目。无需托管,赞助或订阅。

  • 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.

用法:

FTW,它有一个易于记忆的dogue-speak-esque命令行界面:

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

终端输出:

HTML报告:

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

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