本文介绍了WatchOS 单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 Apple Watch 构建一个应用程序,并想编写一个简单的单元测试.我环顾四周,没有找到为 watchOS 代码添加单元测试包的单一方法.Xcode 支持 iOS、macOS 甚至 tvOS 的单元测试,但不支持 watchOS.有没有人做过,如果是,有什么诀窍?

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?

推荐答案

不,watchOS 目前(从 watchOS 3 开始)不支持单元或 UI 测试.您可以做的是将非 watchOS 特定代码交叉编译到共享库中,然后在另一个平台上对其进行单元测试.

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.

这篇关于WatchOS 单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 19:19