What's New > Version 2020.12.02

Enhancing Spring Controller tests

Release date: Dec 18, 2020

Indexing enhancements

When you first load a project, Diffblue Cover creates an index to understand the code as well as relationships between dependent pieces of code. In this release we have improved indexing of multi-module projects, with significantly smaller on-disk index sizes. Up to 75% smaller on some multi-module projects.

Spring Controller Tests

Cover now writes more concise tests for Spring Controllers. By avoiding the declaration of multiple intermediate variables, we can now chain assertion calls and produce tests for Spring Controllers that are more compact, readable, and maintainable.

MockMvcBuilders.standaloneSetup(this.petController).build().perform(requestBuilder)
  .andExpect(MockMvcResultMatchers.status().isOk())
  .andExpect(MockMvcResultMatchers.model().size(3))
  .andExpect(MockMvcResultMatchers.model().attributeExists("owner", "pet", "types"))
  .andExpect(MockMvcResultMatchers.view().name("pets/createOrUpdatePetForm"))
  .andExpect(MockMvcResultMatchers.forwardedUrl("pets/createOrUpdatePetForm"));
  

But how do I maintain all of these tests?

Use Diffblue Cover on any CI platform to automatically update your unit tests and catch regressions for every commit - watch this video to learn more


Full Release Notes

Enhancements

  • IntelliJ Plugin: Cover’s indexing of multi-module projects has been significantly improved, resulting in a reduction in indexing time. Single module projects are also likely to see improvements. Additionally, the on-disk index size has been reduced. [Ref: TG-12822]

  • Cover now writes more concise tests for Spring Controllers by combining act and assert sections. [Ref: TG-11876]

Resolved Issues

  • Resolved an issue where, in some circumstances, tests may be created with assertions containing a specific date and time. [Ref: TG-13384]

  • CLI: Resolved an issue where, in some environments, Countly [EventImpl] Cannot deserialize event from JSON may be unnecessarily logged to log files. [Ref: TG-13368]

  • CLI: Resolved an issue where, in environments where analytics.diffblue.com is inaccessible, executing commands such as dcover --help would take longer than necessary to complete. [Ref: TG-13355]

  • CLI: Resolved a cosmetic issue in the output of dcover help clean. [Ref: TG-12931]

  • Resolved an issue where, in some circumstances, tests may not be written for methods that return a class with generic parameters. [Ref: TG-12770]

Known Issues

  • CLI: Windows: creating config.json by outputting --example-config as file causes exceptions. [Ref: TG-11198]

  • CLI: All tests may be discarded in test validation when using --config. [Ref: TG-11475]

  • CLI: dcover clean --working-directory throws an error if --test-output-dir is not provided. [Ref: TG-11665]

  • CLI: dcover fails to generate tests, reporting java.lang.OutOfMemoryError, when analysing projects which spawn a quantity of threads in excess of the operating system’s process thread limit. [Ref: TG-11680]

  • CLI: dcover clean --failing fails when used with a Gradle project. [Ref: TG-11707]

  • CLI: Test validation may fail on a Gradle project due to an incompatibility between Gradle and Cover. If you encounter this issue, run with --skip-test-validation. [Ref: TG-12045]