代码覆盖率测试

单元测试代码覆盖率的浅谈     https://blog.csdn.net/zyou1986/article/details/80496509

#!/bin/bash
cd ${WORKSPACE}/${JOB_BASE_NAME}
sudo ${MAVENHOME}/bin/mvn org.jacoco:jacoco-maven-plugin:prepare-agent -f pom.xml -s ${MAVENHOME}/tmp/settings.xml -gs ${MAVENHOME}/tmp/settings.xml clean test -Dautoconfig.skip=true -Dmaven.test.skip=false -Dmaven.test.failure.ignore=true

/**
* 执行单元测试,并收集结果
* @return
*/
def junitTest() {
def junitTestSh = libraryResource encoding: 'yss', resource: junittest
sh(script: "${junitTestSh}${shellMsgToWrite}", label: '执行单元测试', returnStdout: needShellReturn)
dir("${JOB_BASE_NAME}") {
junit "**/target/surefire-reports/TEST-*.xml"
//jacoco指标参数https://jenkins.io/doc/pipeline/steps/jacoco/
jacoco changeBuildStatus: true,
maximumClassCoverage: "${classCoverage}",
maximumMethodCoverage: "${methodCoverage}",
maximumBranchCoverage: "${branchCoverage}",
maximumLineCoverage: "${lineCoverage}"

//archiveArtifacts artifacts: '**/target/surefire-reports/TEST-*.xml', fingerprint: true
}
}

猜你喜欢

转载自www.cnblogs.com/wozhangdale1/p/12411249.html
今日推荐