Possible to prevent XCode from envoking debugger after calling `XCUIApplication().terminate()`

时间:2016-04-04 17:26:21

标签: ios xcode-ui-testing

I'm using UITest for testing an objective C app, using swift for the tests.

XCode 7.3, sim 9.3

Every test case invokes XCUIApplication.launch(), which kills any running application by sending SIGKILL.

Xcode treats this like a crash - invoking the debugger on main.m. To proceed with the test suite I just click the continue button in the debugger.

After hitting continue, my log says:

Message from debugger: Terminated due to signal 9

This situation is frustrating because it happens after 1/4 of my test cases. Causing me to lose focus on the document I'm editing and causing my test suite to hang until I hit continue.

Is there a way around this?

2 个答案:

答案 0 :(得分:4)

我们遇到了同样的问题。经过一些调试后,我们发现这是因为您的应用已启用Background Modes

我们的解决方案是为所有Background Modes禁用的开发和测试制定新目标。

仅供参考,在项目设置的Capabilities部分,它被标记为Background Modes,此Off是关键。或者,您可以从Info.plist中删除Require background modes(又名UIBackgroundModes)键

答案 1 :(得分:0)

您可以在使用xCode终止后进行调试和/或测试。在菜单中:

  1. 调试
  2. 附加到流程
  3. Likely TargetsBy Process Identifier (PID)
  4. 中选择