如何在 Xcode 7 中使用代码覆盖率?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31096924/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:23:00  来源:igfitidea点击:

How to use code coverage in Xcode 7?

xcodexcode7

提问by Bart?omiej Semańczyk

I know about new feature in Xcode 7 - Code Coverage. I know how to turn it on:

我知道 Xcode 7 中的新功能 - Code Coverage。我知道如何打开它:

go to Edit scheme-> Test-> Infotab -> enable Gather coverage data.

转到编辑方案->测试->信息选项卡 -> 启用收集覆盖数据

I did it, run tests, and... Where is Test Reportfor my tests?

我做到了,运行了测试,然后……我的测试的测试报告在哪里?

回答by Bart?omiej Semańczyk

Since you turned it on in your scheme, and then build and test:

既然你在你的方案中打开了它,然后构建和测试:

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

Go to your Report navigator

转到您的报告导航器

enter image description here

在此处输入图片说明

Then select your last test:
enter image description here

然后选择你的最后一个测试:
在此处输入图片说明

Finally choose Coverage tab:
enter image description here

最后选择 Coverage 选项卡:
在此处输入图片说明

回答by Jakub

Remember also to enabled test coverage in your bot settings, there is new picker in Xcode 7 (Disabled by default)

还要记住在您的机器人设置中启用测试覆盖率,Xcode 7 中有新的选择器(默认禁用)

enter image description here

在此处输入图片说明