I am trying to run UI tests in parallell from the command line using xcodebuild.
我试图使用xcodebuild从命令行并行运行UI测试。
The command I'm using is:
我正在使用的命令是:
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
The test execution works fine on both devices, but I can't see any log messages anywhere. I.e.
测试执行在两个设备上都能正常工作,但我无法在任何地方看到任何日志消息。即
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" StaticTextt = 25.90s点击“MenuButton”按钮t = 25.90s等待no.test.myapp空闲t = 26.14s找到“MenuButton”按钮t = 26.35s等待no.test.myapp空闲t = 26.39s Synthesize event t = 26.46s等待no.test.myapp空闲t = 27.09s点击“FooBar”StaticText
When I only have one destination I can see the log/output of the test (the same output you can see when running tests from Xcode). However, when I add a second destination, the only information that's shown is:
当我只有一个目的地时,我可以看到测试的日志/输出(从Xcode运行测试时可以看到相同的输出)。但是,当我添加第二个目的地时,显示的唯一信息是:
Test case '
Foo.testBar()
passed on iPhone 8'测试用例'Foo.testBar()在iPhone 8上传递'
or
要么
Test case '
Foo.testBar()
failed on iPhone 6s'.测试用例'Foo.testBar()在iPhone 6s上失败'。
This is not very helpful as I would like to know where in the test it failed.
这不是很有帮助,因为我想知道测试失败的地方。
Is this output being logged anywhere? Ideally I would like to see the step-by-step log for each device I run the test on.
此输出是否记录在任何地方?理想情况下,我希望看到我运行测试的每个设备的分步记录。
2 个解决方案
#1
2
There will be an .xcactivitylog in your derived data folder, which is usually at the following path:
派生数据文件夹中将存在.xcactivitylog,通常位于以下路径:
~/Library/Developer/Xcode/DerivedData/<your-app-name>/Logs/Test/
If you've done lots of test runs recently, you'll see a few different logs; feel free to remove these before each test run to keep the directory clean and easy to navigate.
如果你最近做了很多测试,你会看到一些不同的日志;在每次测试运行之前随时删除这些以保持目录清洁并易于导航。
#2
0
You can control the location of your TestSummaries.plist (which you can feed to xchtmlreport
) by adding this flag to your xcodebuild command:
您可以通过将此标志添加到xcodebuild命令来控制TestSummaries.plist(可以提供给xchtmlreport)的位置:
-resultBundlePath resultsDir
-resultBundlePath resultsDir
You should remove the folder between each test run. If you are going to run in parallel, you will probably want a separate results path for each xcodebuild invocation.
您应该在每次测试运行之间删除该文件夹。如果要并行运行,则可能需要为每个xcodebuild调用单独的结果路径。
#1
2
There will be an .xcactivitylog in your derived data folder, which is usually at the following path:
派生数据文件夹中将存在.xcactivitylog,通常位于以下路径:
~/Library/Developer/Xcode/DerivedData/<your-app-name>/Logs/Test/
If you've done lots of test runs recently, you'll see a few different logs; feel free to remove these before each test run to keep the directory clean and easy to navigate.
如果你最近做了很多测试,你会看到一些不同的日志;在每次测试运行之前随时删除这些以保持目录清洁并易于导航。
#2
0
You can control the location of your TestSummaries.plist (which you can feed to xchtmlreport
) by adding this flag to your xcodebuild command:
您可以通过将此标志添加到xcodebuild命令来控制TestSummaries.plist(可以提供给xchtmlreport)的位置:
-resultBundlePath resultsDir
-resultBundlePath resultsDir
You should remove the folder between each test run. If you are going to run in parallel, you will probably want a separate results path for each xcodebuild invocation.
您应该在每次测试运行之间删除该文件夹。如果要并行运行,则可能需要为每个xcodebuild调用单独的结果路径。