我最近注意到@testable import
似乎不适用于Watch Extension模块。
这是我迄今为止所做的尝试:
@testable import ProjectName_WatchKit_Extension
(在扩展程序的构建设置中确认这是正确的模块名称后)。这给了一个没有这样的模块'编译错误。我当然能够通过将所需文件添加到测试目标来成功进行单元测试,但感觉这不应该是必要的。
是否有人能够成功使用@testable import
观看分机?这是应能够做到的事情吗?任何帮助将不胜感激。
答案 0 :(得分:0)
来自Instagram库IGInterfaceDataTable:https://github.com/facebookarchive/IGInterfaceDataTable/tree/e5565a96c5a71ef7b849920adc34f880cc37dc03#testing
Since WKInterfaceTable objects must be initialized from storyboards, and
there is no mechanism yet to create a WatchKit storyboard in code, we cannot use
Xcode unit tests yet.
For now, tests are run manually by executing the ApplicationTests WatchKit
extension and ensuring that none of the asserts are fired.
这是一个很好的问题,我看到针对Quick和Nimble测试框架打开了一个类似的问题,该框架讨论了对手表套件扩展测试缺乏支持的问题。看看:https://github.com/Quick/Quick/issues/273。