WatchOS Unit Testing

2020-07-02 09:06发布

问题:

I am building an app for Apple Watch and want to write a simple unit test. I looked around and didn't find a single way to add a unit testing bundle for watchOS code. Xcode supports unit tests for iOS, macOS and even tvOS but not for watchOS. Has anyone ever done it and if yes what is the trick?

回答1:

No, watchOS does not currently (as of watchOS 3) support unit or UI testing. What you can do is cross-compile non-watchOS-specific code to a shared library, then unit test that on another platform.