首页 > 解决方案 > 更新到 Xcode 10 后 XCUITest 的测试目标似乎不起作用

问题描述

我从 Xcode 9.4 更新到 xcode 10,然后在尝试运行我的 UI 测试时似乎没有任何工作。测试应用程序加载了一段时间,然后测试失败,尽管在测试之前构建已成功完成。并且源代码也成功构建,我可以在模拟器上运行该应用程序。

错误是:

Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying error: The test runner failed to load the test bundle. Executable cannot be loaded for some other reason, such as a problem with a library it depends on or a code signature/entitlements mismatch.))

标签: xcode10xcuitest

解决方案


首先,如果您使用的是 Cocoapods,请确保您的测试目标设置了继承的搜索路径,例如:

# MARK: Common pods
abstract_target 'AppCommon' do
  pod 'Alamofire'

  target 'MyFrameworkA' do
    project './MyPath/MyFrameworkA/MyFrameworkA.xcodeproj'

    target 'MyFrameworkATests' do
      inherit! :search_paths
    end
  end
end

接下来,在FrameworkA的Build 阶段,确保将任何其他框架(A 中使用的 B、C)设置为目标依赖项并添加到Linked Binary With Libraries中。

最后,确保您的FrameworkATests目标在Target Dependencies中有您的FrameworkA ,并且也在Linked Binary With Libraries阶段添加。


推荐阅读