带有最大并发测试模拟器目的地1挂断的xcodebuild

问题描述 投票:-1回答:1

通过xcodebuild在多个目标位置运行我的应用程序的UI和单元测试。而且,如果不进行并行测试,它将在第一个目的地之后冻结。脚本是Fastlane车道

  desc "Run UI and Unit tests"
  lane :tests do

    xcodebuild = "xcodebuild \
    -workspace ../MyApp.xcworkspace -scheme \"Demo\" \
    -destination platform=iOS\\ Simulator,OS=11.4,name=iPhone\\ 8 \
    -destination platform=iOS\\ Simulator,name=iPhone\\ 11 \
    test \
    -maximum-concurrent-test-simulator-destinations 1"

    sh("set -o pipefail && #{xcodebuild} | xcpretty --color")

  end

maximum-concurrent-test-simulator-destinations设置为1,因为Travis无法处理多个模拟器。将最大并发测试模拟器目的地设置为2或更高,则可以正常工作(在我的本地计算机上)控制台输出

[10:20:16]: ▸ 2020-05-12 10:20:16.524 xcodebuild[65456:1245746]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
[10:20:16]: ▸ /Users/user/Library/Developer/Xcode/DerivedData/MyApp-hhnajatcmwzivkcbkmpbygtxpake/Logs/Test/Test-Demo-2020.05.12_10-20-11-+0300.xcresult/Staging/2_Test/Diagnostics/MyAppTests-FAE8B487-284C-40DB-B047-D636446674F3/MyAppTests-DE767895-6440-438A-870C-CC6B04A10DE0/Session-MyAppTests-2020-05-12_102016-h2zfGe.log
[10:20:16]: ▸ 2020-05-12 10:20:16.525 xcodebuild[65456:1245664] [MT] IDETestOperationsObserverDebug: (131BCBB5-8D86-4867-A62B-3D0B314D3D45) Beginning test session MyAppTests-131BCBB5-8D86-4867-A62B-3D0B314D3D45 at 2020-05-12 10:20:16.525 with Xcode 11E503a on target <DVTiPhoneSimulator: 0x7fec47d23170> {
[10:20:16]: ▸ SimDevice: iPhone 8 (5F564306-1082-49FD-960C-C0F5ACC5B97D, iOS 11.4, Shutdown)
[10:20:16]: ▸ } (11.4 (15F79))
[10:20:17]: ▸ 2020-05-12 10:20:17.802 xcodebuild[65456:1245664] [MT] IDETestOperationsObserverDebug: (131BCBB5-8D86-4867-A62B-3D0B314D3D45) Finished requesting crash reports. Continuing with testing.
[10:20:26]: ▸ 2020-05-12 10:20:26.027 xcodebuild[65456:1245735]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
[10:20:26]: ▸ /Users/user/Library/Developer/Xcode/DerivedData/MyApp-hhnajatcmwzivkcbkmpbygtxpake/Logs/Test/Test-Demo-2020.05.12_10-20-11-+0300.xcresult/Staging/2_Test/Diagnostics/MyAppUITests-517BF762-E9D0-4897-A285-576F19851F35/MyAppUITests-9CAA0288-4B7A-46CC-892F-2B41A091D411/Session-MyAppUITests-2020-05-12_102026-JQAEh6.log
[10:20:26]: ▸ 2020-05-12 10:20:26.027 xcodebuild[65456:1245664] [MT] IDETestOperationsObserverDebug: (0D08CB0A-9292-48A4-AF86-C03EF96AABD0) Beginning test session MyAppUITests-0D08CB0A-9292-48A4-AF86-C03EF96AABD0 at 2020-05-12 10:20:26.027 with Xcode 11E503a on target <DVTiPhoneSimulator: 0x7fec47d23170> {
[10:20:26]: ▸ SimDevice: iPhone 8 (5F564306-1082-49FD-960C-C0F5ACC5B97D, iOS 11.4, Booted)
[10:20:26]: ▸ } (11.4 (15F79))
[10:20:26]: ▸ 2020-05-12 10:20:26.034 xcodebuild[65456:1245664] [MT] IDETestOperationsObserverDebug: (0D08CB0A-9292-48A4-AF86-C03EF96AABD0) Finished requesting crash reports. Continuing with testing.
[10:20:45]: ▸ 2020-05-12 10:20:45.082 xcodebuild[65456:1245664] [MT] IDETestOperationsObserverDebug: 28.567 elapsed -- Testing started completed.
[10:20:45]: ▸ 2020-05-12 10:20:45.082 xcodebuild[65456:1245664] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
[10:20:45]: ▸ 2020-05-12 10:20:45.082 xcodebuild[65456:1245664] [MT] IDETestOperationsObserverDebug: 28.567 sec, +28.567 sec -- end

并且较新的内容继续

ios xcodebuild xcode-ui-testing
1个回答
-1
投票

解决方案非常明显。您应该设置parallel-testing-enabled NO而不是maximum-concurrent-test-simulator-destinations 1

在我的情况下,在xcode模式中禁用了并行测试,但这无济于事。您必须将其设置为xcodebuild

© www.soinside.com 2019 - 2024. All rights reserved.