XCUITest的测试目标在更新到Xcode 10后似乎不起作用



我从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.))

首先,如果您正在使用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构建阶段中,确保将任何其他框架(A中使用的B、C(设置为目标依赖项并添加到带库的链接二进制

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

Xcode 10引入了新的构建系统,该系统并行了包括依赖项在内的大多数构建会话。新的构建系统可以检测大多数配置问题。具有异常配置的项目中必须有一个开始失败,并且新的构建系统已经检测到了这一点。关于构建系统,您应该了解的所有内容https://www.xcteq.co.uk/xcblog/five-things-you-must-know-about-xcode-10-new-build-system/

最新更新