Xcode 14.3中xcodebuild用test-without-building时忽略TestPlan问题
解决Xcode 14.3中
test-without-building指定测试计划失效的问题 问题分析
这是Xcode 14.3命令行工具的已知bug:使用test-without-building时,-testPlan参数无法正确覆盖默认测试计划,而test命令或Xcode 14.2版本不受此问题影响。
可行解决方案
方案1:通过
build-for-testing生成对应测试计划的构建产物
先针对目标测试计划构建专属测试包,再用生成的.xctestrun文件执行测试,完全绕开参数解析bug:# 先构建TestPlanUI对应的测试包 xcodebuild build-for-testing -scheme TestPlan -destination 'platform=iOS Simulator,id=<sim_id>' -testPlan TestPlanUI # 用生成的xctestrun文件执行测试(文件通常在Build/Products/Debug-iphonesimulator目录下) xcodebuild test-without-building -xctestrun TestPlan_TestPlanUI.xctestrun -destination 'platform=iOS Simulator,id=<sim_id>'方案2:调整命令参数顺序
部分用户反馈将-testPlan参数提前到-destination之前可触发正确解析,尝试修改命令:xcodebuild -scheme TestPlan -testPlan TestPlanUI -destination 'platform=iOS Simulator,id=<sim_id>' test-without-building方案3:调整Xcode版本
临时回退到Xcode 14.2(若项目兼容),或者升级到Xcode 14.3.1及以上版本(苹果大概率在后续小版本修复该bug)。
补充建议
该问题属于Xcode命令行工具的解析逻辑缺陷,建议通过苹果开发者反馈助手提交问题报告,推动官方修复。
内容的提问来源于stack exchange,提问作者streem
相关产品推荐
相关产品推荐

