当 运行 并行测试时 UI 测试的输出

Output of UI tests when running tests in parallell

我正在尝试使用 xcodebuild 从命令行并行进行 运行 UI 测试。

我使用的命令是:

xcodebuild 
     -verbose 
     -workspace "MyWorkspace.xcworkspace" 
     -scheme "User Interface Tests" 
     -sdk iphonesimulator 
     -destination 'platform=iOS Simulator,id=5193368C-B000-4ED1-99F6-E23F7BAB9F69' 
     -destination 'platform=iOS Simulator,id=9B751E0D-8268-4DDF-ADAC-CBF2508F4CCC'
     test

测试执行在两台设备上都运行良好,但我在任何地方都看不到任何日志消息。 IE。

t = 25.90s Tap "MenuButton" Button
t = 25.90s Wait for no.test.myapp to idle
t = 26.14s Find the "MenuButton" Button
t = 26.35s Wait for no.test.myapp to idle
t = 26.39s Synthesize event
t = 26.46s Wait for no.test.myapp to idle
t = 27.09s Tap "FooBar" StaticText

当我只有一个目的地时,我可以看到测试的 log/output(当从 Xcode 测试 运行 时你可以看到相同的输出)。但是,当我添加第二个目的地时,显示的唯一信息是:

Test case 'Foo.testBar() passed on iPhone 8'

Test case 'Foo.testBar() failed on iPhone 6s'.

这不是很有帮助,因为我想知道测试失败的地方。

这个输出是否被记录在任何地方?理想情况下,我希望看到我 运行 测试的每台设备的分步日志。

你的派生数据文件夹中会有一个.xcactivitylog,一般在以下路径:

~/Library/Developer/Xcode/DerivedData/<your-app-name>/Logs/Test/

如果您最近进行了大量测试运行,您会看到一些不同的日志;在每次测试前随意删除这些 运行 保持目录干净且易于浏览。

您可以通过将此标志添加到您的 xcodebuild 命令来控制 TestSummaries.plist 的位置(您可以将其提供给 xchtmlreport):

-resultBundlePath resultsDir

您应该在每次测试之间删除文件夹 运行。如果您要并行 运行,您可能需要为每个 xcodebuild 调用提供单独的结果路径。