jenkins pipeline新增代码覆盖率检查

作者: root007 分类: jenkins 发布时间: 2020-01-03 15:24

插件:
Cobertura Plugin

example

 //Stage 2 : 单元测试
  stage('Test'){
    container('py3') {
		//sh ("python run_unittest.py")
		sh label: '', script: 'pylint ./servers/ -rn --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" > pylint-report.txt|| exit 0'
		sh ("coverage erase")
		sh ("coverage run --branch --source=.  run_unittest.py")
		sh ("coverage xml -i")
		//sh ("nosetests --with-xunit")
    publishCoverage adapters: [coberturaAdapter(path: '*coverage*.xml', thresholds: [[thresholdTarget: 'Aggregated Report']])], sourceFileResolver: sourceFiles('NEVER_STORE')  
    }

发表评论

电子邮件地址不会被公开。 必填项已用*标注