2025-06-03

This release introduces google-java-format as the new default code formatter, expands test coverage for generic classes and complex code structures, and delivers significant performance and stability improvements for the IntelliJ plugin.

  • Default Formatter & Test Management:

    • Code Formatter: Diffblue Cover now uses google-java-format as its default formatter for generated tests, ensuring consistent, modern styling out-of-the-box. This may cause a one-time formatting change in existing test files.

    • Test Annotations: Cover now annotates the tests and helper methods it creates with @ManagedByDiffblue, allowing it to safely update them in future runs. This provides greater flexibility and clearer attribution.

  • Expanded Test Coverage:

    • Generics & Mocks: Test generation has been enhanced for generic classes and now provides more appropriate return values for mocks, increasing method coverage in complex scenarios.

    • Core Engine: Resolved multiple issues that previously blocked test creation, including those related to Java 9+ module restrictions, inaccessible parent classes, and certain Spring Controller status codes.

  • IDE & Tooling Stability:

    • IntelliJ Plugin: Resolved critical issues that could cause test writing to stall or the IDE to become unresponsive, significantly improving performance and reliability.

    • TestNG: Fixed an issue to ensure setup and teardown methods are correctly applied when manual TestNG tests are in the same file as Diffblue tests.

Important Notices

Changes to test code

  • Test formatting: In this release (2025.06.03), Cover has switched 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. If you would prefer not to use the new default and avoid this reformatting, you can configure an alternative formatter in your build system, which will override this setting.

  • Test tagging and ownership annotations: In this release (2025.06.03), Cover has replaced @Tag("MaintainedByDiffblue") with the new @ManagedByDiffblue and @Tag("ContributionFromDiffblue") annotations. This change 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) have been 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.

Enhancements

  • Diffblue Cover now generates more tests for generic classes. This improvement helps achieve fuller method coverage in scenarios where different generic types are needed. [Ref: TG-23312]

  • Diffblue Cover now writes tests using DiffblueRules factories and @InTestsMock without requiring manual parameter configuration. The necessary parameters for the factory methods are now automatically generated, streamlining advanced test creation. [Ref: TG-23236]

  • Diffblue Cover now uses google-java-format as its default code formatter for generated tests. This may cause one-time formatting changes in projects without a specified formatter. An alternative formatter can be configured in the build system to override this. [Ref: TG-23125]

  • Diffblue Cover now annotates setup and teardown methods it generates with @ManagedByDiffblue. This allows Diffblue Cover to modify or delete these methods in subsequent runs, providing greater flexibility. Requires cover-annotations v1.4.0 or higher. [Ref: TG-23045]

  • Diffblue Cover now annotates new tests with @ManagedByDiffblue and @Tag("ContributionFromDiffblue") when using cover-annotations v1.4.0 or higher, providing clearer attribution and aligning with current best practices for test management. [Ref: TG-23031]

  • Diffblue Cover now better determines appropriate return values for mocks, resulting in more generated tests. This enhances coverage in scenarios where objects are difficult to instantiate, leading to more comprehensive test suites. [Ref: TG-22643]

Resolved Issues

  • Plugin: Resolved an issue that caused test writing to stall during environment checks within the IntelliJ plugin. This was triggered by projects with additional classpath entries, for example from Spring AOT, and has now been corrected. [Ref: TG-23383]

  • Resolved an issue that could prevent test generation. Diffblue Cover now correctly handles scenarios where a method uses a class that extends another class which is inaccessible from the package under test, preventing compilation errors and increasing test output. [Ref: TG-23363]

  • Resolved an issue where manual TestNG tests could fail when placed in the same file as tests written by Diffblue Cover. This was caused by setup and teardown methods not being correctly applied to manual tests, which is now fixed. [Ref: TG-23348]

  • Resolved an issue that prevented Diffblue Cover from writing tests for code on Java 9+ due to Java module system restrictions. It now correctly handles field accessibility, increasing test generation for affected code, such as that using character sets. [Ref: TG-23338]

  • Resolved an issue where Cover would improperly handle enclosing class types, which prevented test generation for non-static inner classes extending from a generic superclass. [Ref: TG-23324]

  • Resolved an issue where Diffblue Cover would produce an F009 internal error when analyzing code with certain enclosing types. Diffblue Cover now correctly handles these structures, successfully generating tests in cases where it previously failed. [Ref: TG-23316]

  • Plugin: Resolved an issue where Diffblue Cover would fail with an F009 internal error for default interface methods. It now correctly identifies when no implementation is available and reports a T009, providing clearer feedback to the user. [Ref: TG-23309]

  • Resolved an issue that could prevent test generation in rare situations involving mocking a Collection, resulting in an F009 error. Diffblue Cover is now able to proceed with test creation in these cases, unblocking test writing for the affected methods. [Ref: TG-23308]

  • Resolved an issue that prevented Diffblue Cover from writing tests for Spring Controller methods returning UNAUTHORIZED or INTERNAL_SERVER_ERROR statuses. Diffblue Cover now successfully generates tests for these HTTP response status codes. [Ref: TG-23307]

  • Resolved an issue where Diffblue Cover would incorrectly process @InTestsMock annotations that forbid mocking. This ensures the annotation's behavior is consistent and predictable when guiding test generation. [Ref: TG-23175]

  • Plugin: Resolved an issue where Diffblue Cover could cause the IntelliJ IDE to become unresponsive when opening or switching between files. The update process for gutter icons has been optimized, resulting in significantly improved IDE performance. [Ref: TG-23170]

Known Issues

  • Plugin: Diffblue Cover incorrectly displays a menu option to write tests for existing test files. [Ref: TG-17163]

  • CLI & Plugin: Cover may write tests for JUnit 4.10 and lower that do not compile due to the use of assertNotEquals. [Ref: TG-17605]

  • 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]

  • Diffblue Cover does not currently support test creation for projects using Java 24; please use JDK 21 or lower. [Ref: TG-22920]

Last updated

Was this helpful?