我想在各种平台版本上测试相同的单元测试。但是,由于 xcodebuild 错误,我不能。
我建立了我的项目
xcodebuild build-for-testing \
-configuration Debug \
-scheme UnitTest \
-sdk iphonesimulator \
-enableCodeCoverage YES \
-derivedDataPath "derivedData"
并使用以下命令成功执行测试项目:
xcodebuild test-without-building \
-configuration Debug \
-derivedDataPath "derivedData" \
-resultBundlePath TestResultsA \
-project UTSSampleSwift.xcodeproj \
-scheme UnitTest \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,OS=13.5,name=iPhone SE (2nd generation)' \
-enableCodeCoverage YES
我想在 OS=12.2 上进行测试,并且我已经安装了 12.2 的模拟器但是,以下命令失败
xcodebuild test-without-building \
-configuration Debug \
-derivedDataPath "derivedData" \
-resultBundlePath TestResultsE \
-project UTSSampleSwift.xcodeproj \
-scheme UnitTest \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,OS=12.2,name=iPhone 8' \
-enableCodeCoverage YES
带有错误消息:
Build settings from command line:
SDKROOT = iphonesimulator13.5
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:12.2, name:iPhone 8 }
Available destinations for the "UnitTest" scheme:
{ platform:macOS, arch:x86_64, variant:Mac Catalyst, id:521A4BA2-C8DB-50F6-9112-FA4FB75F8B5D }
{ platform:iOS Simulator, id:FB9D6640-64BC-48D2-869F-2D8AE3D10984, OS:13.5, name:iPad (7th generation) }
{ platform:iOS Simulator, id:2327E5B6-8073-4DA7-BB2C-4D9F29E8A74F, OS:13.5, name:iPad Air (3rd generation) }
{ platform:iOS Simulator, id:176CD5F5-F59D-401F-8D9C-2567C97BF14F, OS:13.5, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:50CDB544-EB94-494D-BA02-2A387F49C36A, OS:13.5, name:iPad Pro (11-inch) (2nd generation) }
{ platform:iOS Simulator, id:2D39CA24-88E5-4012-A461-63404BBF8DD5, OS:13.5, name:iPad Pro (12.9-inch) (4th generation) }
{ platform:iOS Simulator, id:CEC5D35B-9038-4557-ABD8-414290716B84, OS:13.5, name:iPhone 8 }
{ platform:iOS Simulator, id:A375FB0B-6F1C-4249-95B8-EC71D9FB6144, OS:13.5, name:iPhone 8 Plus }
{ platform:iOS Simulator, id:81EFCF5E-372A-4CB4-94D5-409D23237392, OS:13.5, name:iPhone 11 }
{ platform:iOS Simulator, id:884192AD-0156-4E86-87F7-BFC24D451D33, OS:13.5, name:iPhone 11 Pro }
{ platform:iOS Simulator, id:A2F32AF0-CE1E-47F3-9D5A-D3E906B7977B, OS:13.5, name:iPhone 11 Pro Max }
{ platform:iOS Simulator, id:0EB5214D-201F-405F-BDAF-E77089398CA9, OS:13.5, name:iPhone SE (2nd generation) }
Ineligible destinations for the "UnitTest" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }
我应该怎么办?
附加信息
xcodebuild-版本
Xcode 11.5
Build version 11E608c
xcodebuild -showsdks
iOS SDKs:
iOS 13.5 -sdk iphoneos13.5
iOS Simulator SDKs:
Simulator - iOS 13.5 -sdk iphonesimulator13.5