gpt4 book ai didi

ios - _XCTFailInCurrentTest 只应在测试运行时调用

转载 作者:可可西里 更新时间:2023-11-01 05:40:21 24 4
gpt4 key购买 nike

我现在正在使用 Xcode 进行 UITesting,但遇到了这个错误。

* Assertion failure in void _XCTFailInCurrentTest(NSString *, ...)(), /Library/Caches/com.apple.xbs/Sources/XCTest_Sim/XCTest-10112/XCTestFramework/Classes/XCTestCase.m:63 2016-05-13 22:31:54.961 XCTRunner[15428:168507] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_XCTFailInCurrentTest should only be called while a test is running. Failure description: Failed to receive completion for

我在这里看到了其他类似的帖子。

Cannot run Xcode (7.3) UI tests in Jenkins

我正在使用 Jenkins,但现在,我直接从 Xcode 运行,甚至无法从 Xcode 运行。我该怎么办?

最佳答案

背景

  • 我在 Xcode 7.3 (7D175) 和 iOS Simulator 9.3 中遇到过这个问题。
  • 症状如下
    • Test Runner 正常启动并退出。
    • 在此之后,被测应用从未启动。
    • (如果未安装被测应用程序,Xcode 也不会在开始测试之前安装该应用程序)。
    • (副作用是录音对我也不起作用 - 我从 this SO post.) 中获得灵感

30 秒后测试超时:

XCTRunner[36260:489138] Continuing to run tests in the background with task ID 1    
2016-05-18 16:17:25.720 XCTRunner[36260:489138] *** Assertion failure in void _XCTFailInCurrentTest(NSString *, ...)(), /Library/Caches/com.apple.xbs/Sources/XCTest_Sim/XCTest-10112/XCTestFramework/Classes/XCTestCase.m:63
2016-05-18 16:17:25.723 XCTRunner[36260:489138] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '_XCTFailInCurrentTest should only be called while a test is running.
Failure description: Failed to receive completion for <XCDeviceEvent:0x7fddc241f970 page 12 usage 64 duration 0.01s within 30.0s'

对我有用的修复是:

  • 重置模拟器。
  • 检查是否在 UI 测试目标的build设置中将部署目标设置为 iOS 9.x。 (在我的例子中,它被设置为 iOS 8)
  • 更改目标后,清理并重建。

执行这些步骤后,Xcode 能够在测试前安装应用程序,录制正常,错误消失。

关于ios - _XCTFailInCurrentTest 只应在测试运行时调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37212693/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com