简体   繁体   English

Developer pod单元测试的代码覆盖率

[英]Code coverage for Developer pod unit tests

Right now I'm unit testing my Developer CocoaPods which is working fine. 现在我正在测试我的Developer CocoaPods,它运行正常。 Tests are running and working inside the Example project. 测试正在Example项目中运行并运行。

However, the code coverage only takes coverage of the project files, not the Developer pod files: 但是,代码覆盖率仅覆盖项目文件,而不是Developer pod文件:

在此输入图像描述

I'm looking for a way to give feedback about the pod code coverage. 我正在寻找一种方法来提供有关pod代码覆盖率的反馈。 Any ideas? 有任何想法吗?

This problem is known and a solution is given on Cocoapod's github . 这个问题是已知的,并且在Cocoapod的github上给出了解决方案。

The solution should be to enable code coverage on the library as well. 解决方案应该是在库上启用代码覆盖。 But this doesn't work for my new pod. 但这不适用于我的新吊舱。 However, testing the library by adding the test target to its "Test" actions does work. 但是,通过将测试目标添加到其“测试”操作来测试库确实有效。 But I also see coverage for others pods, which is not what I want. 但是我也看到了其他豆荚的报道,这不是我想要的。

Also, we have another project which, by running tests on the demo app's scheme, shows the code coverage for the pod's files, as expected. 此外,我们还有另一个项目,通过在演示应用程序的方案上运行测试,按预期显示pod文件的代码覆盖率。 Can't find the differences between the two projects. 找不到两个项目之间的差异。

So this is a "search in progress" bug. 所以这是一个“正在搜索”的错误。

Update: this answer worked for me. 更新: 这个答案对我有用。

Dummy guide for @teriiehina's answer. @ teriiehina答案的虚拟指南。

  1. Go to Product -> Scheme -> Edit Scheme... 转到产品 - >方案 - >编辑方案...
  2. Click Test 单击Test
  3. Enable code coverage for the Example project 启用Example项目的代码覆盖率

启用代码覆盖

  1. Click Build 单击Build

  2. Click + in the lower-left corner. 单击左下角的+ Select the development pod target 选择开发窗格目标

在此输入图像描述

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

相关问题 单元测试的Xcode 9代码覆盖率显示错误百分比 - Xcode 9 code coverage on unit tests showing wrong % 如何使用UI单元测试获得嵌入式框架的Xcode 8代码覆盖率 - How to get Xcode 8 Code Coverage for embedded framework using UI Unit Tests 当没有单元测试时,为什么Xcode 7显示大约12%的代码覆盖率? - Why Xcode 7 shows around 12% code coverage when there are no unit tests at all? 没有测试的 Xcode 中的代码覆盖率(用于手动运行) - Code coverage in Xcode without tests (for manual run) 单元测试策略,理想代码覆盖基线 - Unit Testing Strategy, Ideal Code Coverage Baseline 为什么我不能将 Pod 单元测试文件导入主机应用程序单元测试文件 - Why can't I import Pod Unit Tests file into host application Unit Tests file 如何在 100% 代码覆盖率的 Xcode 单元测试中编写 do {} catch {} - How to write do {} catch {} in Xcode unit test with 100% code coverage 单元测试覆盖率%0 - Unit test Coverage percentage %0 Xcode7 / iOS9:单元测试:iPhone开发人员:模棱两可(与“ iPhone开发人员:Max M.(团队A ID)和” iPhone开发人员:Max M.(Team B ID)匹配) - Xcode7 / iOS9: Unit Tests: iPhone Developer: ambiguous (matches “iPhone Developer: Max M. (Team A ID) and ”iPhone Developer: Max M. (Team B ID)) 为什么单元测试中的代码无法找到捆绑资源? - Why can't code inside unit tests find bundle resources?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM