可能在调用`XCUIApplication().terminate()`之后阻止XCode调用调试器. [英] Possible to prevent XCode from envoking debugger after calling `XCUIApplication().terminate()`
问题描述
我正在使用UITest来测试目标C应用程序,并使用swift进行测试.
I'm using UITest for testing an objective C app, using swift for the tests.
XCode 7.3,sim 9.3
XCode 7.3, sim 9.3
每个测试用例都调用XCUIApplication.launch(),该事件通过发送SIGKILL杀死所有正在运行的应用程序.
Every test case invokes XCUIApplication.launch(), which kills any running application by sending SIGKILL.
Xcode将其视为崩溃-在main.m
上调用调试器.要继续测试套件,我只需单击调试器中的继续按钮.
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
这种情况令人沮丧,因为它发生在我的测试用例的1/4之后.导致我失去对正在编辑的文档的关注,并导致我的测试套件挂起,直到单击继续.
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?
推荐答案
我们遇到了同样的问题.经过一些调试后,我们发现这是由于为您的应用启用了Background Modes
造成的.
We experienced the same issue. After some debugging we found out this was caused by having Background Modes
enabled for your app.
我们的解决方案是为所有禁用Background Modes
的开发和测试设定新目标.
Our solution was to make a new target for development and testing that has all Background Modes
disabled.
仅供参考,在项目设置的Capabilities
部分中,将其标记为Background Modes
,然后按此Off
键即可.或者,您可以从Info.plist
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
这篇关于可能在调用`XCUIApplication().terminate()`之后阻止XCode调用调试器.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!