Can I run several iOS UI Tests in Parallel?
Asked Answered
M

2

11

I'm working on building a UI Test suite for my iOS app. I need to test my app's functionality on several different devices, but right now I have to select the simulator I want, run the tests, and then repeat.

Now that Xcode supports multiple simulators running in parallel, is there a way to run the UI tests across several different device simulators at the same time?

Merovingian answered 11/12, 2017 at 14:54 Comment(2)
Have you checked github.com/linkedin/bluepill ?Bernita
I was able to this by following this guide: medium.com/@t.camin/parallelizing-ui-tests-28c16000f141.Job
C
5

Run the following command in the same directory as your project to run your tests in parallel from the command line:

xcodebuild test -scheme "YourSchemeName" -destination 'platform=iOS Simulator,OS=11.2,name=iPhone 8' -destination 'platform=iOS Simulator,OS=11.2,name=iPhone 6s'  -configuration "Debug" ENABLE_TESTABILITY=YES SWIFT_VERSION=4.0 ONLY_ACTIVE_ARCH=YES

You can add -destination 'platform=iOS Simulator,OS=11.2,name=iPhone 8' for a different destination for as many different destinations as you would like.

For a list of simulator names and OSs that are available, run the command:

instruments -s devices

Bear in mind that if you are running tests in the simulator, you will not see the simulators on your screen when running tests through the command line.

Copperhead answered 13/12, 2017 at 10:39 Comment(1)
For Xcode 13 and later, use xctrace list devices instead. (instruments has been removed.)Sanguinaria
F
4

In Xcode:

  1. Select your target scheme in Xcode, and "Edit Scheme..."
  2. Find the settings for "Test", and press on the "Info" tab
  3. You'll see a list of your Unit and UI tests, press on the associated "Options..." button
  4. Select "Execute in parallel on Simulator"
  5. Optionally select "Randomize execution order"

Enable Parallel Testing


Commandline:

Look at this answer here

Functional answered 11/11, 2018 at 6:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.