Created
February 6, 2021 02:37
-
-
Save wf-adamhei/55efb0a5d8f0736d967925a51a710fb2 to your computer and use it in GitHub Desktop.
This file contains 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
partitioned_test_cases = [] | |
pipeline { | |
environment { | |
TARGET_PARALLEL_AGENTS = 3 | |
} | |
stages { | |
stage(“Partition UI tests”) { | |
steps { | |
script { | |
def testClassNames = getAllUITestClassNames() | |
def testClassNamesWithSuite = testClassNames.collect { “WealthfrontUITests/${it}” } | |
def partition = partitionTestClassNames(testClassNamesWithSuite, | |
env.TARGET_PARALLEL_AGENTS as Integer) | |
partitioned_test_cases = partition | |
} | |
} | |
} | |
stage(‘Parallel Execution’) { | |
steps { | |
runTestsInParallel() | |
} | |
} | |
} | |
} | |
def runTestsInParallel() { | |
def numBranches = partitioned_test_cases.size() | |
def branches = [:] | |
for (int i = 0; i < numBranches; i++) { | |
def branchName = “${i + 1}/${numBranches} branch” | |
def index = i | |
branches[branchName] = { | |
node (‘iOS’) { | |
sh(“fastlane ui_tests only_testing:${testCases}”) | |
junit(allowEmptyResults: true, testResults: ‘fastlane/test_output/*.junit’) | |
} | |
} | |
} | |
parallel branches | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment