[JaCoCo (Java Code Coverage)] Use with NetBeans

Loading the library

Add the following to pom referring to the contents of the official website (www.jacoco.org)

pom.xml


<project>
	<build>
        <pluginManagement>
            <plugins>
               <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>***</version>
                    <executions>
                        <execution>
                            <id>default-prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>default-report</id>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>default-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <!--  implementation is needed only for Maven 2  -->
                                    <rule implementation="org.jacoco.maven.RuleConfiguration">
                                        <element>BUNDLE</element>
                                        <limits>
                                            <!--  implementation is needed only for Maven 2  -->
                                            <limit implementation="org.jacoco.report.check.Limit">
                                                <counter>COMPLEXITY</counter>
                                                <value>COVEREDRATIO</value>
                                                <minimum>0.60</minimum>
                                            </limit>
                                        </limits>
                                    </rule>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

How to use

If you execute the following in maven, the report will be generated in target / site / jacoco / index.html.

mvn clean jacoco:prepare-agent test jacoco:report

(In NetBeans, [Right click on project] → [Run Maven] → [Goal])

Recommended Posts

[JaCoCo (Java Code Coverage)] Use with NetBeans
Use Lambda Layers with Java
Use SpatiaLite with Java / JDBC
Use PlantUML with Visual Studio Code
Use java with MSYS and Cygwin
Use Microsoft Graph with standard Java
Use Azure Bing SpellCheck with Java
Use JDBC with Java and Scala.
Java build with mac vs code
Execute packaged Java code with commands
Prepare Java development environment with VS Code
Link Java and C ++ code with SWIG
Execute Java code from cpp with cocos2dx
Script Java code
Java code TIPS
Static code analysis with Checkstyle in Java + Gradle
Java sample code 02
Java sample code 03
How to use Java framework with AWS Lambda! ??
[Java] Explanation of Strategy pattern (with sample code)
I want to use java8 forEach with index
Java sample code 04
How to use Java API with lambda expression
Use Matplotlib from Java or Scala with Matplotlib4j
Using Gradle with VS Code, build Java → run
[JAVA] [Spring] [MyBatis] Use IN () with SQL Builder
[Java] Use Collectors.collectingAndThen
Java sample code 01
Java character code
Try debugging a Java program with VS Code
Build a Java development environment with VS Code
Code to use when you want to process Json with only standard library in Java
Use fast Mapping library MapStruct with Lombok and Java 11
Build Java development environment with VS Code on Mac
Getting started with Java programs using Visual Studio Code
[Java] [Spring Boot] Specify runtime profile --Spring Boot starting with NetBeans
Use aggregate queries (Count) with Azure CosmosDB Java SDK
Why can I develop Java with Visual Studio Code?
Play with Java function nodes that can use Java with Node-RED
Build Java development environment with WSL2 Docker VS Code
How to build Java development environment with VS Code
Use java1.7 (zulu7) under a specific directory with jenv
[Environment construction] Build a Java development environment with VS Code!
Check coverage with Codecov in Java + Gradle + Wercker configuration
Build Java program development environment with Visual Studio Code
Java coverage measurement library
Use ProGuard with Gradle
Lombok with VS Code
Change seats with java
Install Java with Ansible
Use Puphpeteer with Docker
Comfortable download with JAVA
Use XVim2 with Xcode 12.0.1
Use CentOS with LXD
Use ngrok with Docker
Use webmock with Rspec
Download Java with Ansible
Let's scrape with Java! !!
Use WebJars with Gradle
Build Java with Wercker
Use PreparedStatement in Java