Can you run Xcuitests in parallel?
Asked Answered
M

3

6

Wondering if anyone has found a way to run Xcuitests in parallel. 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.

So sub question, how do you run a specific Xcuitest from the command line?

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!

Michelmichelangelo answered 27/9, 2015 at 16:15 Comment(0)
H
3

Update- I was able to run a suite of tests across 4 simulators simultaneously using https://github.com/linkedin/bluepill

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. Just be aware when using xcodebuild you need to use xcode --select to specify which xcode to run things on.

Finally with Xcode 8 we have the ability to run individual testcases with the -only-testing: flag. Run your xcodebuild command as you normally would and append -only-testing:YOURTESTBUNDLE/YOURTESTSUITE/YOURTESTCASE

Good luck!

Higgs answered 16/1, 2017 at 17:48 Comment(0)
C
3

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:

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.

Cheops answered 27/6, 2018 at 4:33 Comment(3)
This is exactly what I was after (upvoted). Is there a way to get the simulators to actually load so I can see the tests being run rather than just seeing in the terminal that they passed?Hydrolysis
@CharlieSeligman The command in my answer actually starts simulators / devices and runs tests on them.Cheops
Weird. Moved 'test' a new line at the bottom of the command and all working now. Then moved back to original command and all worked there too. Must have been an issue on my machine. Thanks for this answer - working great now!Hydrolysis
J
0

Look at the FBSimulatorControl. I hope it's help you.

Jamima answered 30/9, 2015 at 20:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.