我正在将旧的Jenkins构建迁移到声明性管道。我们使用xUnit插件发布单元测试,对于JUnit,以下工作正常:
step([$class: 'XUnitBuilder',
thresholds: [[$class: 'FailedThreshold', unstableThreshold: '1']],
tools: [[$class: 'JUnitType', pattern: '**/surefire-reports/*.xml'],
[$class: 'JUnitType', pattern: '**/generatedJUnitFiles/JUnit/*.xml'],]
])
我的问题是我无法弄清楚如何发布我们的助推测试。是否BoostType
与JUnitType
相似,或者还不支持加强测试?
答案 0 :(得分:6)
答案结果是BoostTestJunitHudsonTestType。这是代码:
step([$class: 'XUnitBuilder',
thresholds: [[$class: 'FailedThreshold', unstableThreshold: '1']],
tools: [[$class: 'JUnitType', pattern: '**/surefire-reports/*.xml'],
[$class: 'JUnitType', pattern: '**/generatedJUnitFiles/JUnit/*.xml'],
[$class: 'BoostTestJunitHudsonTestType', pattern: '**/*_results.xml'],
]])
答案 1 :(得分:2)
Jenkins'中有一个班级BoostTest
。 xUnit Plugin
答案 2 :(得分:1)
new xunit Plugin syntax较轻且可读性强:
pipeline {
agent any
stages {
stage('Test'){
steps {
sh "run_tests.bash"
}
}
}
post {
always{
xunit (
thresholds: [ skipped(failureThreshold: '0'), failed(failureThreshold: '0') ],
tools: [
JUnit(pattern: '**/surefire-reports/*.xml'),
JUnit(pattern: '**/generatedJUnitFiles/JUnit/*.xml'),
BoostTest(pattern: '**/*_results.xml')]
)
}
}
}