OpenClover 4.4.0 Release Notes
Welcome! A lot of time has passed since the previous release, but we're thrilled to announce our new
OpenClover 4.4! In this release we focused on improving Maven integration, delivering a number of
useful and highly requested features. But you will find a lot of other goodies too!
Method contexts with code metrics
The clover:setup and clover:instr goals now allows you to fine-tune scope of code coverage with a new
methodWithMetricsContext option. In the methodContext option it was possible to define a name
pattern for methods, which shall be excluded from code coverage measurement. With this new option you
can define not ony regular expression for entire method signature but also code metrics.
<regexp>public .* get.*\(\)</regexp>
<maxComplexity>1</maxComplexity> <!-- at most 1 cycle (optional) -->
<maxStatements>1</maxStatements> <!-- at most 1 statement (optional) -->
<maxAggregatedComplexity>2</maxAggregatedComplexity> <!-- no more than 2 cycles including inline classes (optional) -->
<maxAggregatedStatements>10</maxAggregatedStatements> <!-- no more than 10 statements including inline classes (optional) -->
<!-- can add more methodWithMetricsContext -->
will define a context called 'simpleGetter' which matches all public get*() methods containing at most one
statement; this statement may contain more complex logic (an anonymous inline class) but not more than 10
statements in total; in addition to this aggregated cyclomatic cannot exceed 2 cycles.
Custom test detector patterns
In Ant plugin it is possible to configure in <clover-setup> or <clover-instr> which files,
classes and methods are test ones. This allows to handle custom test frameworks or even
external test tools. Now this is possible in Maven too, although the configuration is slightly different due
differences between Ant and Maven build systems (Ant - file sets with sources, Maven - main/test source roots).
In clover:setup and clover:instr goals you can define the testSources configuration option, which is
really very robust and flexible. You can define your tests not only on a file level (includes and excludes),
but also on a class level (matching all elements from a class signature) and even fine-tune it on a
method level (again, entire method signature).
<testClass> <!-- 0..N occurrences -->
<testMethods> <!-- 0..N occurrences -->
Include failed test coverage
In the clover:check and clover:clover goals you can use includeFailedTestCoverage. When enabled,
code coverage related with failed tests will be included when calculating the total coverage percentage.
This can you help to get more stable test coverage results in case of failing or flaky tests.
Show unique per-test coverage
With this option OpenClover will calculate and show unique per-test coverage in reports. Unique means
that given piece of business logic is covered by only one test. It can help you to better plan writing
Maven 2.x is unsupported
OpenClover 4.4 no longer supports Maven 2.x. Minimum Maven version required is 3.0.4.
Although OpenClover is flexible enough to handle
any test framework
better to have support out-of-the box. So here you are! OpenClover now:
- supports test methods with public, package and protected visibility as JUnit5 allows to
- recognizes @org.junit.jupiter.api.Test and @org.junit.jupiter.api.Disable annotations
- handles JUnit 5 parameterized tests
We'd like to say huge Thank you!
for James Spagnola who implemented this feature.
Bamboo 6.9 with OpenClover
Bamboo 6.9 has built-in support for not only Atlassian Clover but also OpenClover. It means that you
no longer have to use manual integration (by adding clover targets or goals in your pom.xml or build.xml files),
but you can not enable OpenClover with a single click thanks to the automatic integration feature, which works
for Ant, Maven and Grails tasks.
New options for CloverInstr
In the course of implementation of enhancements for Maven, the CloverInstr commandline tool got a lot of new
options as well:
-mmc --methodWithMetricsContext 'name;regexp;maxstmt;maxcplx;maxaggrstmt;maxaggrcplx' Defines a single custom method context with code metrics.
-tsr --testSourceRoot path Root folder for test sources against which includes/excludes are checked.
-tsi --testSourceIncludes ant_pattern Which files shall be treated as test sources.
-tse --testSourceExcludes ant_pattern Which files shall not be treated as test sources.
-tsc --testSourceClass 'name;package;annotation;superclass;javadoc tag' Which classes shall be treated as test code.
-tsm --testSourceMethod 'name;annotation;return_type;javadoc_tag' Which methods shall be treated as test ones.
-tsc '.*Test;com\.acme\..*' - match by a package and a class name
-tsc ';;@RunWith' - match by a class annotation
-tsc ';;;;@test' - match by a javadoc tag
-tsm 'test.*' - match all methods prefixed with 'test'
-tsm ';@Test;void' - match all void methods annotated with '@Test'
-tsm ';;;@test' - match all methods having a '@test' javadoc tag
Upgrading from OpenClover 4.3.x
Clover for Ant
Simply download new Clover-for-Ant zip file and use the clover.jar from it.
Clover for Eclipse
Download new update site ZIP and install in your Eclipse.
Clover for IDEA
Download new plugin JAR and install in your IDEA.
Clover Maven Plugin
Bump version number to 4.4.0 for 'org.openclover:clover-maven-plugin' and 'org.openclover:clover' in
your pom.xml files.
Grails Clover Plugin
Upgrade to version 4.4.0.
Bamboo Clover Plugin
Upgrade to Bamboo 6.9. You will get automatic integration feature for OpenClover. In case of Maven and Grails
tasks it automatically integrates with the latest OpenClover version. In case of Ant tasks it integrates with
OpenClover 4.3.1 (you can switch to manual integration to use the latest version).
Jenkins Clover Plugin
Upgrade to the latest 4.11.0 plugin version.
Hudson Clover Plugin
Upgrade to the latest 4.9.0 plugin version.
Gradle Clover Plugin
2019.09.26 OpenClover 4.4.0