Created
July 3, 2020 05:56
-
-
Save jubinjacob19/64c280fd2ea5943c2028e12808fa324e to your computer and use it in GitHub Desktop.
Python Script to shard UITests in Xcode project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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