[英]Creating test cases in objective-c static library with XCTest
I have a static library in objective-C that has 1 main class, which is the delegate to multiple classes and includes delegate methods to handle server calls and location updates. 我在Objective-C中有一个静态库,该库具有1个主类,该主类是多个类的委托,并且包括用于处理服务器调用和位置更新的委托方法。 Since I'm developing a static library, only logic unit test is supported.
由于我正在开发静态库,因此仅支持逻辑单元测试。 I'm having a hard time coming up with test cases.
我很难提出测试用例。 I read articles on unit testing that suggests not to test private methods and constructors.
我阅读了有关单元测试的文章,这些文章建议不要测试私有方法和构造函数。 I wrote basic tests like testing a async method that makes an api call and checking the delegate method's return value.
我编写了一些基本测试,例如测试进行api调用的异步方法并检查委托方法的返回值。 What is a good starting point when creating logic unit tests for a static library?
为静态库创建逻辑单元测试时,一个好的起点是什么?
Since I'm developing a static library, only logic unit test is supported.
由于我正在开发静态库,因此仅支持逻辑单元测试。
Actually, you can create a little app to serve as the test host. 实际上,您可以创建一个小应用程序作为测试主机。 Then you're not limited to logic tests — you can test anything you want.
然后,您不仅限于逻辑测试-您可以测试任何您想要的东西。 You can test every aspect of your class.
您可以测试课程的各个方面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.