2025-06-02

2025-06-02

This release enhances how Diffblue Cover writes tests by adding new mock configuration controls to handle more complex scenarios, and by improving its resilience to project configuration issues.

  • Mock Configuration & Control:

    • Mocks: Cover now provides greater control over generated mocks using new @InTestsMock attributes. You can direct Cover to generate mocks that throw specific exceptions (throwException) or create custom return values from an object factory (returnValueFactory).

  • Core Engine & Tooling Stability:

    • Core Engine: Addressed R005 and F009 errors that could prevent Cover from writing tests in projects with missing parent dependencies or corrupt .jar files.

    • CLI & Plugin: Improved stability by resolving a CLI issue with the --new-jacoco-coverage command and fixing a performance issue in the IntelliJ plugin that could cause the UI to become unresponsive.

Important Notices

Changes to test code

  • Test formatting: In the 2025.06.03 release, Cover will switch the default test formatting style to google-java-format. This change will cause a one-time reformatting of existing test files, resulting in larger-than-usual diffs. An alternative formatter configured in your build system will override this new default.

  • Test tagging and ownership annotations: In the 2025.06.03 release, Cover will replace @Tag("MaintainedByDiffblue") with the new @ManagedByDiffblue and @Tag("ContributionFromDiffblue") annotations. This will cause a one-time update to existing Diffblue tests. To take ownership of a test and prevent it from being overwritten, remove its @ManagedByDiffblue annotation.

    • Action Required for DiffblueBuild.yaml: To ensure correct coverage reporting, users with a DiffblueBuild.yaml file from before release 2025.06.02 must manually update it. Replace all instances of "MaintainedByDiffblue" with "MaintainedByDiffblue,ContributionFromDiffblue" and set the file version to 2.1.

Deprecations

  • Cover Reports authentication properties: The deprecated reports.requiredusername and reports.requiredpassword properties (and their corresponding REPORTS_REQUIREDUSERNAME/PASSWORD environment variables) will be removed in the 2025.06.03 release. Please migrate to the new reports.users.upload.username and reports.users.upload.password properties (or the REPORTS_USERS_UPLOAD_USERNAME and REPORTS_USERS_UPLOAD_PASSWORD environment variables) to prevent upload failures after the update.

Removed Features

  • --existing-coverage option: The CLI option --existing-coverage for the dcover create command has been removed as of this release (2025.06.02). To write tests that target only new coverage, use the --new-jacoco-coverage option.

Enhancements

  • Diffblue Cover now includes improved error handling for missing dependencies on the classpath. This enhancement prevents test generation from failing when a parent class cannot be found, significantly reducing R005 errors. [Ref: TG-23232]

  • Diffblue Cover now offers two ways to configure thrown exceptions from mocks using @InTestsMock. Specify an exception directly by its Class with the throwException attribute, or by a factory method with throwExceptionFactory. [Ref: TG-23051]

  • Diffblue Cover now allows specifying a factory for creating custom object return values in mocks, using the new returnValueFactory field in the @InTestsMock annotation. [Ref: TG-22955]

  • Plugin: Diffblue Cover can now be installed on IntelliJ IDEA Community Edition 2025.2 EAP and IntelliJ IDEA Ultimate 2025.2 EAP. This support is currently in preview mode. [Ref: TG-22566]

Resolved Issues

  • CLI: Resolved an issue where Diffblue Cover could behave unreliably when using --new-jacoco-coverage with missing coverage data. Cover now warns users if JaCoCo .exec files are empty and provides a reason for keeping newly generated tests. [Ref: TG-23297]

  • Resolved an issue where Diffblue Cover would report an F009 (Internal Error) when encountering a Java InternalError. This fix correctly handles InternalError ensuring tests are written for previously affected methods. [Ref: TG-23265]

  • Resolved an issue that caused Diffblue Cover to report an F009 (Internal Error) when encountering corrupt files, such as broken .jar archives, on the classpath. [Ref: TG-23263]

  • Plugin: Resolved an issue causing the IntelliJ UI to become unresponsive when writing tests for large scopes. Test preparation is now an optimized background task, ensuring the UI remains interactive and test generation starts faster. [Ref: TG-23012]

  • Resolved an issue where Diffblue Cover would incorrectly report E054 (No class files found) for modules without source files. It now reports E129 (No source files found) to reduce confusion and improve diagnostics. [Ref: TG-21053]

Known Issues

  • Plugin: Cover incorrectly provides a menu option to write tests for a test file. [Ref: TG-17163]

  • Cover supports Open JDK and Oracle JDK; results with other JDKs may differ due to the variability in their implementations of Java. [Ref: TG-19345]

  • Reports: Cover only counts Java code towards the total line count metrics. Kotlin code is not currently included. [Ref: TG-22088]

  • Reports: Total lines of code metric can incorrectly count a multi-line comment at the end of a line of code, resulting in fewer than expected lines counted. [Ref: TG-22089]

  • Reports: Following an upgrade, the 'Total Lines of Code' card may show 0 until a new reports bundle has been uploaded. [Ref: TG-22094]

  • In some circumstances, Cover may write more simplistic tests with less meaningful assertions when Spring Boot dependency injection is disabled. [Ref: TG-22102]

  • In some circumstances, Cover will still write Spring Boot tests when Spring Boot dependency injection is disabled. [Ref: TG-22103]

  • Cover may write failing TestNG tests when Spring Boot dependency injection is disabled. [Ref: TG-22107]

  • Plugin: On some displays, the Test Review subsection title "Tests for review" can be malformed. [Ref: TG-22805]

  • Cover does not currently support Java 24. Please switch your JDK version to 21 or lower. [Ref: TG-22920]

Last updated

Was this helpful?