We will see how to enable code coverage for your Java project and view coverage report in Jenkins UI.
step # 1: Add Maven JaCoCo plugin in POM.xml under MyWebApp in bitbucket Repo
<build>
<finalName>MyWebApp</finalName>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Step 2 : Add JaCoCo plug-in in Jenkins:
Step 3:
For Freestyle Job:
Enable in Jenkins job to view code coverage report by going to post build action and add Record JaCoCo coverage report
For Pipelines:
Add below code in your existing pipeline:
stage ('Code coverage') {
jacoco()
}
Step 4 : Run the job by clicking Build now
Step 5:
Click on the job to view code coverage report.



ReplyDeleteWhen searching for reliable printing solutions, many customers turn to a Best DTF transfer company that offers high-quality transfers at affordable prices. Their expertise and advanced technology ensure vibrant, durable designs that meet all expectations. Choosing the right partner in this industry can significantly impact your business's growth and customer satisfaction. Trust in a company that prioritizes quality and efficiency to help you succeed in the competitive market.
9277489D
ReplyDeleteGiresun Esçort
Isparta Esçort
Tokat Esçort
Tunceli Esçort
Aydın Esçort
Kilis Esçort
Ordu Esçort
Bolu Esçort
Kayseri Esçort