2023-02-02

Diffblue Cover extends the types of custom inputs that can be specified in DiffblueRules.yml

Diffblue Cover can now use values specified via immediate constant values supporting single- or multi-dimensional arrays.

For example, the following configuration specifies a single unconditional default rule for String[] and String[][]:

  java.lang.String[]:
    - immediate: [ "Hello", "World!" ]
    - immediate: # this rule uses different syntax for the same rule as above
      - "Hello"
      - "World!"

  java.lang.String[][]:
    - immediate: [ [ "Multidimension", "arrays" ], [ "are", "also", "supported" ] ]
    - immediate: # this rule uses different syntax for the same rule as above
      - [ "Multidimension", "arrays" ]
      - [ "are", "also", "supported" ]
    - immediate: # this rule uses another syntax variation for the same rule
      - - "Multidimension"
        - "arrays"
      - - "are"
        - "also"
        - "supported"

In addition to general purpose factory methods, it's also common to provide classes in the src/test/java source tree with factory methods for use specifically in tests. In the following example a factory method is used to provide an array of ISBN instances for use where an array of ISBN objects is required:

  com.example.library.ISBN[]:
    - factory:
        method: com.example.library.ISBNTestSupport.isbnArrayForTesting:()[Lcom/example/library/ISBN;

For more information check out Customizing test inputs

Enhancements

  • CLI: Cover now outputs a list of tests which failed during test validation to the console and log file. [Ref: TG-18369]

  • Cover now allows immediate values for array literals to be specified in DiffblueRules.yml. See the 'Customizing test inputs' documentation for more details. [Ref: TG-18619]

  • Cover now allows factory methods which produce arrays to be specified in DiffblueRules.yml. See the 'Customizing test inputs' documentation for more details. [Ref: TG-18595]

  • Cover now uses better inputs for Map objects whilst writing tests. [Ref: TG-18420]

Resolved Issues

  • Resolved an issue which caused Cover to not provide a warning when JDK 8u251 or earlier was in use. The minimum supported version is now JDK 8u261. [Ref: TG-18670]

  • Resolved an issue which, in some circumstances, caused Cover to report R083 (Can't find a suitable constructor) while writing tests for trivial methods when a factory method is available. [Ref: TG-18594]

  • Resolved an issue which caused Cover to incorrectly report E066 (Dependency incompatible with JDK) when Spring dependencies are mismatched. [Ref: TG-18519]

  • IntelliJ Plugin: Resolved an issue which caused Cover to silently fail, after clicking 'fix all issues', when project environment health check issues were detected in projects which are unable to be fixed. [Ref: TG-18615]

Known Issues

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

  • Reports: Firefox users may encounter It seems like we encountered an error. Try refreshing this page or contact your administrator. while loading the Coverage Reports tab. [Ref: TG-18257]

  • IntelliJ Plugin: Upgrading to IntelliJ IDEA 2022.3 may, in some circumstances, cause existing run configurations to no longer produce tests. Removing any run configurations for that entity and writing tests again will recreate a working run configuration. [Ref: TG-18282]

Last updated