2025-05-02

2025-05-02

This release enhances test generation for Spring controllers and Strings with validation annotations, introduces a new CLI test management command, and resolves issues with JUnit 5 test retention and Gradle coverage reporting.

  • Test Generation & Quality:

    • More precise mock parameters for Spring controller tests, improving coverage and Spring-specific scenarios.

    • Improved inputs for String types with Java Beans Validation, JPA @Column, or Hibernate @Length annotations, yielding more suitable inputs and tests.

    • Simplified factory method specifications in DiffblueRules.yaml (name and parameters), removing need for verbose descriptors.

    • Fix for JUnit 5 @DisplayName issue; whole test classes no longer discarded on single method failure, improving test retention.

  • CLI Enhancements & User Control:

    • New dcover remove CLI command for project-wide deletion of generated tests.

  • Reports:

    • Fix for dcover coverage-reports showing 0% for Gradle projects with no manual tests; Cover-generated test coverage now correctly shown.

Important Notices

Changes to test code

  • Test formatting: In a future release, Cover will switch the default test formatting style to google-java-format. This will cause a one-time churn, resulting in larger-than-usual diffs in your test code. If you prefer a different style, an alternative formatter configured in your build system will override this new default.

Enhancements

  • CLI: Diffblue Cover now writes tests for Spring controllers by creating mock parameters with greater precision. This results in more comprehensive test coverage and better generation of Spring-specific test scenarios. [Ref: TG-23011]

  • Diffblue Cover now creates tests with improved inputs for Strings governed by Java Beans Validation, JPA's @Column, or Hibernate's @Length annotations. This results in more suitable test inputs, increasing the number of tests produced. [Ref: TG-23010]

  • CLI: Diffblue Cover now enables project-wide deletion of its generated unit tests via the new dcover remove command. This function is particularly useful for cleaning up tests after a trial or when changing test file organization. [Ref: TG-22923]

  • Diffblue Cover now uses simplified factory method specifications in DiffblueRules.yaml for guiding test generation, identifying methods by name and parameters. Providing the full, verbose descriptor is no longer necessary, simplifying the configuration. [Ref: TG-22492]

Resolved Issues

  • CLI: Resolved an issue which caused Cover to discard whole JUnit 5 test classes that utilized @DisplayName annotations if any single test method failed. Users now retain more passing tests as validation correctly targets only individual failing tests. [Ref: TG-23156]

  • CLI & Reports: Resolved an issue where dcover coverage-reports would incorrectly show 0% coverage for Gradle projects with no manual tests. Coverage from Diffblue Cover-generated tests is now correctly shown in CLI output and Cover Reports. [Ref: TG-23138]

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?