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

空扰寡人 提交于 2019-12-19 20:47:34

问题


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?


回答1:


We experienced the same issue. After some debugging we found out this was caused by having Background Modes enabled for your app.

Our solution was to make a new target for development and testing that has all Background Modes disabled.

FYI, in the Capabilities section of your project settings it's labeled as Background Modes turning this Off is key. Alternatively, you could remove the Require background modes (aka UIBackgroundModes) key from your Info.plist




回答2:


You can go for debugging and/or testing after termination using xCode. In the menu:

  1. Debug
  2. Attach to Process
  3. Choose from Likely Targets or By Process Identifier (PID)


来源:https://stackoverflow.com/questions/36409060/possible-to-prevent-xcode-from-envoking-debugger-after-calling-xcuiapplication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!