I've verified that the test output XML files are *not* interfering in between branches. So I'm suspecting some pipeline build global state that xUnit keeps in either a shared object instance or some file?
def integrationTestsStage(selectedAgent) {
def pipelineRunBranches = [:]
pipelineRunBranches['itests-withEmptyDatabase'] = {
node(selectedAgent) {
deleteDir()
unstash '<stashed-src-code-label>'
boolean hasException = true
try {
sh "maven-build-command"
hasException = false
} finally {
step([$class : 'XUnitPublisher',
testTimeMargin: '3000',
thresholdMode : 1,
thresholds : [[$class : 'FailedThreshold',
failureNewThreshold : '0',
failureThreshold : '0',
unstableNewThreshold: '0',
unstableThreshold : '0'],
[$class : 'SkippedThreshold',
failureNewThreshold : '',
failureThreshold : '',
unstableNewThreshold: '',
unstableThreshold : '']],
tools : [[$class : 'JUnitType',
deleteOutputFiles : true,
failIfNotNew : true,
pattern : '<maven-module>/target/failsafe-reports/TEST-*.xml',
skipNoTestFiles : hasException,
stopProcessingIfError: true]]
])
}
}
}
pipelineRunBranches['itests-withPopulatedDatabase'] = {
node(selectedAgent) {
deleteDir()
unstash '<stashed-src-code-label>'
try {
hasException = true
sh "<maven-build-command>"
hasException = false
} finally {
step([$class : 'XUnitPublisher',
testTimeMargin: '3000',
thresholdMode : 1,
thresholds : [[$class : 'FailedThreshold',
failureNewThreshold : '20',
failureThreshold : '20',
unstableNewThreshold: '5',
unstableThreshold : '5'],
[$class : 'SkippedThreshold',
failureNewThreshold : '',
failureThreshold : '',
unstableNewThreshold: '',
unstableThreshold : '']],
tools : [[$class : 'JUnitType',
deleteOutputFiles : true,
failIfNotNew : true,
pattern : '<maven-module>/target/failsafe-reports/TEST-*.xml',
skipNoTestFiles : hasException,
stopProcessingIfError: true]]
])
}
}
}
parallel pipelineRunBranches
}