【发布时间】:2015-12-16 16:42:43
【问题描述】:
我在运行 xctool build 时遇到故障。我的命令如下:
xctool clean build run-tests -only 'MyApp KIF Tests' -workspace MyApp.xcworkspace/ -scheme 'Debug' -destination "platform=iOS Simulator,name=iPhone 6,OS=latest" -sdk iphonesimulator -reporter junit -reporter plain
构建失败并出现以下错误:
Failed to query the list of test cases in the test bundle: Test bundle not found at: /Users/myusername/Library/Developer/Xcode/DerivedData/MyApp-blbvnisblktossbxwcmnxafkngts/Build/Products/Debug-iphonesimulator/MyApp KIF Tests.xctest
我在错误消息中指定的路径中查找了MyApp KIF Tests.xctest,确实找不到该文件。但是,此文件确实存在于不同的路径下:
/Users/myusername/Library/Developer/Xcode/DerivedData/MyApp-blbvnisblktossbxwcmnxafkngts/Build/Products/Debug-iphoneos/MyApp KIF Tests.xctest
这两个路径的唯一区别是一个在Debug-iphonesimulator下,另一个在Debug-iphoneos下。
我还注意到,在 target -> Build Settings -> Build Locations -> Per-configuration Build Products Path -> Debug 下,值是$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME),其评估结果为build/OktaVerify.build/Debug-iphoneos。所以第一个问题是:为什么$(EFFECTIVE_PLATFORM_NAME) 评估为Debug-iphoneos?我需要更改什么配置以使其评估为 Debug-iphonesimulator 以便 xctool 可以找到它?
接下来,我将$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 的值硬编码为Debug-iphonesimulator,希望看到它正常工作。但是,我得到了同样的错误。我的第二个问题是,为什么即使构建产品路径指定Debug-iphonesimulator,xctest 文件也会出现在Debug-iphoneos 文件夹下?指定 Debug-iphoneos 的设置是什么?
环境为 Xcode 7.2 和 xctool 版本 0.2.8。
【问题讨论】:
-
这个测试目标是 UIAutomation 测试目标吗?
-
@BandoKal 这是一个测试目标,但不是 UIAutomation。目前我们仍在使用 KIF 进行 UI 测试
-
@SeaJelly 你解决过这个问题吗?
-
@jungledev 是的,最后我从上面的命令中删除了“-sdk iphonesimulator”,它开始工作了
-
您可以在下面的正式回答部分回答您自己的问题,接受您的回答,这将使您获得对您的回答的支持。感谢您的及时回复!
标签: ios xcode xcodebuild xctool