2023-04-01

Diffblue Cover CLI writes the same tests as the Diffblue Cover IntelliJ Plugin just at a larger scale. Cover CLI can:

  • write tests for your whole Java project in one go

  • run locally on a laptop or on a server in CI

  • integrate into any CI pipeline to write and maintain your unit tests automatically

Cover CLI comes with the Preflight check capability to ensure that your project is configured correctly for Cover CLI to undertake this mammoth task of writing thousands of unit tests, and to then analyse your coverage and report this to the Diffblue Cover Reports analytics platform.

In this release, Cover CLI Preflight will also check your existing tests are passing and their coverage; this is important to ensure that your coverage analytics are calculated correctly; and hey, who doesn't want to make sure their unit tests are passing?

  INFO  Environment summary:
  INFO  --------------------
  INFO  Java version                  17.0.5              SUCCESS
  INFO  Build system                  Gradle              SUCCESS
  INFO  Mocking Framework             Mockito 4.5.1       SUCCESS
  INFO  Testing framework             JUnit Jupiter 5     SUCCESS
  INFO  Hamcrest                      Hamcrest 2 2.2      SUCCESS
  INFO  Spring Core                   5.3.21              SUCCESS
  INFO  Spring Boot                   2.7.1               SUCCESS
  INFO  Spring Boot Test              2.7.1               SUCCESS
  INFO  Spring Web                    5.3.21              SUCCESS
  INFO  Spring Test                   5.3.21              SUCCESS
  WARN  Test execution                                    WARNING
  INFO
  WARN  Environment check status: WARNING
  INFO  Running existing tests, this can take a few minutes.
  WARN  E035: Running existing tests failed
  WARN  Diffblue Cover tried to run the command "gradle test", but it failed.
  WARN  The output from running this command is available towards the end of the log
  WARN  file. While Diffblue Cover could not figure out the reason for this and cannot
  WARN  fix it automatically, this issue is usually due to an incorrect command, or due
  WARN  to the failure of existing, user-provided tests.

Enhancements

  • Cover now runs existing tests as part of the Preflight checks. This can be disabled by passing --without-tests. See the Preflight checks documentation for more details. [Ref: TG-18651]

  • Cover now writes Spring Repository tests which are more likely to use distinct data items rather than duplicating them. [Ref: TG-18905]

  • Updated SnakeYAML dependency in Cover Reports and Cover IntelliJ Plugin. [Ref: TG-18891]

  • Cover now provides a stack trace when it encounters R081 (Exception in arrange section) to help identify the reason tests could not be written. [Ref: TG-18734]

Resolved Issues

  • Resolved an issue which caused Cover to attempt to write tests for projects using Spring Core 6 or Spring Boot 3, which are not currently supported. Cover now outputs a recommendation to use Spring Core 5 or Spring Boot 2. [Ref: TG-18868]

  • IntelliJ Plugin: Resolved an issue which caused Cover to show 'Fix issue' button(s) for issues which were not fixable. [Ref: TG-18812]

  • IntelliJ Plugin: Resolved an issue which caused Cover to misclassify dependency libraries on the classpath as code to be tested. [Ref: TG-18800]

  • Resolved an issue which caused Cover to report Internal error when executing a test, ignoring and continuing when temporary files were not deleted. [Ref: TG-18779]

  • Resolved an issue which, in some circumstances, caused Cover to report Missing Spring component. Cover now looks in more locations for an XML configuration to use in Spring tests. [Ref: TG-18731]

  • IntelliJ Plugin: Resolved an issue which caused Cover to write tests at the source language level rather than the bytecode version level specified in the project. [Ref: TG-18530]

  • Resolved an issue which caused Cover to not report an error if the version of Gradle is not compatible with the version of Java, i.e. Gradle 7.3 or higher is needed on Java 17 projects and Gradle 5.0 or higher is needed on Java 11 projects. [Ref: TG-16879]

  • CLI: Resolved an issue which caused Cover to write the user log file to different locations depending on command being run. [Ref: TG-16827]

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