Skip to content

Instantly share code, notes, and snippets.

@jubinjacob19
Created July 3, 2020 05:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jubinjacob19/64c280fd2ea5943c2028e12808fa324e to your computer and use it in GitHub Desktop.
Save jubinjacob19/64c280fd2ea5943c2028e12808fa324e to your computer and use it in GitHub Desktop.
Python Script to shard UITests in Xcode project
import os
import errno
import sys
shard_index = sys.argv[1]
PATH = os.path.dirname(os.getcwd())
TESTSPATH = os.path.join(PATH,"Example/UITests/")
tests = []
shard_tests = ""
target = "Example_UITests"
for _, _, files in os.walk(MODELSPATH):
for filename in files:
test_name = os.path.splitext(filename)[0]
if test_name.endswith('UITests'):
tests.append(test_name)
tests.sort()
i = int(shard_index)
while i < len(tests):
shard_tests += " '-only-testing:%s/%s'" %(target, tests[i])
i += 2
print shard_tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment