Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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