简体   繁体   English

您可以并行运行Xcuitests吗?

[英]Can you run Xcuitests in parallel?

Wondering if anyone has found a way to run Xcuitests in parallel. 想知道是否有人找到了并行运行Xcuitests的方法。 Pretty sure this functionality isn't built in but it may be possible to write a script that can spread it over multiple machines if you can run a specific Xcuitest from the command line. 可以肯定的是,该功能不是内置的,但是如果您可以从命令行运行特定的Xcuitest,则可以编写一个脚本将其分散到多台计算机上。

So sub question, how do you run a specific Xcuitest from the command line? 因此,子问题是如何从命令行运行特定的Xcuitest?

I'd appreciate it if anyone's played around with this and can share what they've learned or if they have any resources they could point me to. 如果有人在玩这个游戏并且可以分享他们所学到的东西,或者如果他们有任何资源可以指向我,我将不胜感激。 Thanks! 谢谢!

Update- I was able to run a suite of tests across 4 simulators simultaneously using https://github.com/linkedin/bluepill 更新-我能够使用https://github.com/linkedin/bluepill同时在4个模拟器上运行一套测试

I have been able to run one test on a physical device and one on a simulator simultaneously. 我已经能够同时在物理设备上运行一项测试,并在模拟器上运行一项。 Additionally It might be possible to run more if you install additional versions of Xcode. 此外,如果安装其他版本的Xcode,则可能会运行更多代码。 Just be aware when using xcodebuild you need to use xcode --select to specify which xcode to run things on. 请注意,使用xcodebuild时需要使用xcode --select来指定要在其上运行内容的xcode。

Finally with Xcode 8 we have the ability to run individual testcases with the -only-testing: flag. 最后,使用Xcode 8,我们可以使用-only-testing:标志来运行各个测试用例。 Run your xcodebuild command as you normally would and append -only-testing:YOURTESTBUNDLE/YOURTESTSUITE/YOURTESTCASE 像往常一样运行xcodebuild命令,并附加-only-testing:YOURTESTBUNDLE/YOURTESTSUITE/YOURTESTCASE

Good luck! 祝好运!

If you want to run the same XCUITests on multiple platforms (simulators and devices) in parallel then you can use following command with Xcode 9: 如果要在多个平台(模拟器和设备)上并行运行相同的XCUITest,则可以对Xcode 9使用以下命令:

xcodebuild test -workspace YourApp.xcworkspace \
                -scheme "YourUITestsTarget" \
                -destination "platform=iOS Simulator,OS=11.4,name=iPad Pro (12.9-inch)" \
                -destination "platform=iOS,name=Visput iPad Pro"

You can define as many destinations as you need. 您可以根据需要定义任意多个目的地。

Look at the FBSimulatorControl. 查看FBSimulatorControl。 I hope it's help you. 希望对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM