In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use jacoco plug-in jenkins to quickly achieve statistical unit test coverage", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn "how to use jacoco plug-in jenkins to quickly achieve statistical unit test coverage"!
Install jenkinswget http://mirrors.jenkins.io/war-stable/2.176.4/jenkins.warjava-jar jenkins.war Reference
Installing Jenkins via Java
jenkins optional plug-in is empty solution or jenkins cannot be networked
Install git, maven, jacoco and other plugins
Git plugin and JaCoCo plugin required
Configure maven
Configuration Unit Test Task
Spring-petclinic is a classic spring boot project, which we also chose here for unit testing and test coverage statistics. The project address is https://github.com/spring-projects/spring-petclinic.
Select the New Item link in Jenkins
Enter the new task page as follows
Enter spring-petclinic-uttest, select "Build a maven project" and click the "OK" button
General tab
leave the default values
Source Code Management tab
Repository URL Enter github.com/spring-projects/spring-petclinic.git
Build Triggers tab
leave the default values
Pre Steps tab
Enter "clean verify" in the Goals and options text box.
Post-build Actions tab
Click the Add post-build-Actions drop-down box and select the Record JaCoCo coverage report entry
Keep the default options, click the Save button at the end
Perform unit test tasks to view unit test coverage
According to the network situation and whether this task is executed for the first time, this task may take a long time to execute, and it is easy to interrupt and report errors. This time, I am newly installed jenkins on Alibaba Cloud host. It has been executed 4 times in total before it succeeds, as shown in the figure below.
The dot Coverage Trend link shows JaCoCo Coverage Trend at the bottom right as shown below
Continue to click anywhere in the JaCoCo Coverage Trend area to display the unit test coverage report as shown below
summary
This article explains how to trigger unit test execution using jenkins and use jacoco plug-in to count unit test case coverage through a specific example.
At this point, I believe that everyone has a deeper understanding of "how to use jacoco plug-in jenkins to quickly achieve statistical unit test coverage," may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.