1下载jacoco,并上传至服务器:https://www.eclemma.org/jacoco/ 2.应用服务tomcat的catalina.sh增加jacocoagent #JAVA_OPTS="$JAVA_OPTS -javaagent:/Users/qiaojiafei/Documents/work/jacoco/jacoco-0.8.3/lib/jacocoagent.jar=includes=
1下载jacoco,并上传至服务器:https://www.eclemma.org/jacoco/
2.应用服务tomcat的catalina.sh增加jacocoagent
#JAVA_OPTS="$JAVA_OPTS -javaagent:/Users/qiaojiafei/Documents/work/jacoco/jacoco-0.8.3/lib/jacocoagent.jar=includes=*,classdumpdir=classes,output=tcpserver,address=127.0.0.1,port=6300"
2.jenkins的pipeline配置
node { stage('Test') { echo 'This is a test step' checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/develop']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'bad9f924--4416-9f5e-', url: 'http://:8000/qiaojiafei/platform-qa.git']]] sh 'mvn clean test -DapiTest.xml -Dmaven.test.failure.ignore=true' } stage('rd code') { echo 'This is a test step' checkout poll: false, scm: [$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'bad9f924--4416-9f5e-', url: 'http://:8000/qingzhuhotel/qingzhutool.git']]] sh 'mvn compile' } stage('DumpFromServer'){ echo 'This is a DumpFromServer step' sh label: '', script: 'mvn org.jacoco:jacoco-maven-plugin:0.8.3:dump -Djacoco.address=192.168.162.224 -Djacoco.port=6300' } stage('jacoco'){ jacoco() } }
结果展示
jacoco原理
官网介绍:
https://www.jacoco.org/jacoco/trunk/doc/implementation.html
参考:
https://testerhome.com/topics/5757
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。