Skip to content

Instantly share code, notes, and snippets.

@wf-adamhei
Created February 6, 2021 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wf-adamhei/55efb0a5d8f0736d967925a51a710fb2 to your computer and use it in GitHub Desktop.
Save wf-adamhei/55efb0a5d8f0736d967925a51a710fb2 to your computer and use it in GitHub Desktop.
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