如何在Xcode 6上对app扩展进行单元测试 [英] How to unit test an app extension on Xcode 6

查看:73
本文介绍了如何在Xcode 6上对app扩展进行单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何在app扩展目标上执行单元测试,特别是键盘扩展目标?

Does anyone know how to perform unit testing on app extension target, especially keyboard extension target?

我尝试了什么(在单元测试目标中):

What have I tried (in the unit test target):


  • In 常规点击,将其目标设置为扩展目标而不是容器应用。

  • 将Bundle Loader设置为扩展目标的二进制路径,看起来像 $(BUILT_PRODUCTS_DIR)/com.mycompany.keyboard.appex/com.mycompany.keyboard

  • 将测试主机设置为 $(BUNDLE_LOADER)

  • 在Build Phases点击中,将Target Dependencies设置为容器应用和扩展程序。

  • In the "General" tap, set it's target to the extension target instead of the container app.
  • Set the "Bundle Loader" to the path of the binary of the extension target, which looks like $(BUILT_PRODUCTS_DIR)/com.mycompany.keyboard.appex/com.mycompany.keyboard
  • Set the "Test Host" to $(BUNDLE_LOADER).
  • In the "Build Phases" tap, set the "Target Dependencies" to both the container app and the extension.

完成这些工作后,我可以成功构建它,但总是得到测试失败,日志测试目标SogouInputTests遇到错误(测试会话退出(1)。没有签入。如果您认为此错误表示错误,请将日志文件附加到/tmp/TestStatus-UXfvxw.log)

After these things done, I can build it successfully but always get "Test Failed" with an log Test target SogouInputTests encountered an error (Test session exited(1). without checking in. If you believe this error represents a bug, please attach the log file at /tmp/TestStatus-UXfvxw.log).

我正在使用Xcode 6 beta 3.

I'm using Xcode 6 beta 3.

推荐答案

我向Apple报告了这个漏洞。可悲的是,答案是键盘扩展现在不支持单元测试。答案来自Apple:

I have reported the bug to Apple. And sadly, the answer is that the keyboard extension is not support unit test now. The answer comes from Apple:


  • 目前不支持在应用扩展程序中运行单元测试

  • 相反,将要测试的代码纳入框架并在那里测试代码

  • 将框架链接到您的扩展中

这篇关于如何在Xcode 6上对app扩展进行单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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