在Xcode 7代码覆盖范围中排除文件/代码行 [英] Exclude Files/Lines of code in Xcode 7 Code Coverage

查看:280
本文介绍了在Xcode 7代码覆盖范围中排除文件/代码行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Xcode 7中的代码覆盖率范围内排除一些方法或说AppDelegate文件?

How would you exclude a few methods, or say the AppDelegate file, from being tested during Code Coverage in Xcode 7?

我没有使用Gcov。

推荐答案

Xcode覆盖范围由目标生成(您可以按照方案启用它)。我经常做的事情是将所有可测试代码分离到我所有UI代码中的单独DynamicFramework中。如果我愿意,我可以为那个框架生成报道。

Xcode coverage is generated by target (you can enabled it per scheme). Something I often do is separate all my testable code into a separate DynamicFramework from all my UI code. I can generate coverage just for that one framework if i like.

或者你可以看一下在某些第三方报道解析工具中,例如:

Alternatively you could look at some of the 3rd party coverage parsing tools such as:

  • xcov
  • slather

每个工具都会为您生成一组覆盖度指标(基于Xcode生成的覆盖率数据),他们有能力从保险代数中排除特定文件。

Each tool will generate you a set of coverage metrics (based on the coverage data generated by Xcode) and they have the ability to exclude specific files from the coverage generation.

--ignore_file_path -x: Relative or absolute path to the file containing the list of ignored files.



Slather



Slather

# .slather.yml
ignore:
 - ExamplePodCode/*
 - ProjectTestsGroup/*

就我个人而言,我发现xcov看起来更好,但是更细致的

这篇关于在Xcode 7代码覆盖范围中排除文件/代码行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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