Device Farm 生成 .xctestrun 文件,位置存储在
$DEVICEFARM_XCUITESTRUN_FILE
。然而,我的测试每次都失败
xcodebuild: error: Failed to build workspace temporary with scheme Transient Testing.
Reason: There are no test bundles available to test.
Recovery suggestion: Ensure that all package dependencies have resolved and that there are no missing test bundles in the active scheme or test plan.
我打印出 yaml 文件中的 .xctestrun
文件,发现它的内容与我在构建期间由 Xcode 创建的
.xctestrun
文件的格式不同。具体来说,生成文件的顶级对象在 Xcode 文件中显示为子对象,路径为
TestConfigurations/TestTargets
。生成的文件缺少许多顶级对象,例如
TestConfigurations
、
ContainerInfo
、
TestPlan
和
CodeCoverageBuildableInfos
。是否有人使用生成的
.xctestrun
文件在自定义环境中成功运行 iOS UI 测试?根据
man xcodebuild.xctestrun
输出,生成的文件格式不正确。我尝试下载 xctestrun 文件的副本并在本地使用它,但测试也失败。使用 Xcode 创建的
.xctestrun
文件时,我能够在本地成功运行测试。
.xctestrun
文件,而不是使用 Device Farm 生成的文件。然后在我的 YAML 测试规范中,我创建一个文件夹
/tmp/root
并将我的
.xctestrun
文件复制到其中。然后我创建
/tmp/root/Debug-iphoneos
并将我的应用程序和测试包
.app
文件复制到该文件夹中。这完全模仿了我的本地环境,并且成功运行了测试