您如何对CocoaPod代码进行单元测试? [英] How do you Unit Test CocoaPod Code?

查看:83
本文介绍了您如何对CocoaPod代码进行单元测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图将Cocoapods的魔力带入我的公司,但它遇到了一个小障碍。我们需要能够对来自Cocoapods的代码进行单元测试。

I am trying to bring the magic of Cocoapods to my company, but it has hit a tiny snag. We need to be able to unit test code that comes from Cocoapods.

所以,我的问题是,在公司中是否有人遇到过这个问题(或者有人只是偏执狂以至于关心对代码进行单元测试并弄清楚怎么做?)。对于我们来说,这可能不是一个破坏交易的事情,但如果我提前进行了排序,那肯定会帮助管理层解决问题。

So, my question is, has anyone else encountered this in their company (or is anyone just paranoid enough to care about unit testing this code and figured out how?). It may not be a deal breaker for us, but it will definitely help smooth things over with management if I have this sorted ahead of time.

我们可能会插入测试在客户端应用程序中,但是考虑到我们将使用pod来减少手动工作,这就是很多手动工作。最好以某种方式执行一次。

We could probably insert the tests in the client app, but thats an awful lot of manual work considering we would use pods to reduce manual work. It would be nice to do it once somehow.

推荐答案

在我的 Podfile 我使用类似这样的东西: link_with ['Sail','Sail-Tests']

In my Podfile I use something like this: link_with ['Sail', 'Sail-Tests']

此链接全部我的Pod既有正常目标又有测试目标。然后,从我的测试中,我可以导入并测试我想要的任何东西。不过,这可能与在客户端应用程序中插入测试重叠。

This links all my Pods with both my normal target and my test target. Then from my tests I can import and test whatever I want. This may overlap with 'inserting the tests in the client app' though.

这篇关于您如何对CocoaPod代码进行单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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