Knowledge Base > Cover CLI > Cover Refactor: Getting Started

Cover Refactor: Getting Started

Early access feature

Please contact Diffblue support to find out more about availability.

Diffblue Cover Refactor makes your code more testable. It provides refactoring patches to your code that allow Diffblue Cover to create more and better tests for your code.

To use the Diffblue Cover Refactor feature, you need an appropriate license. Further installation details can be found here.

Using Cover Refactor

Diffblue Cover reports Output Codes when running dcover create. Each of these output codes identifies a potential issue with your environment or your code base, which could potentially be fixed automatically. Performing these fixes is the purpose of Diffblue Cover Refactor.

  1. When running dcover create on a module, a file refactorings.yml is stored in the .diffblue directory of the module. This file contains a description of the refactorings that Diffblue Cover Refactor can perform on your code base.

  2. Running dcover refactor applies these refactorings to your code base. You can view the code changes performed by Diffblue Cover Refactor using git diff and commit them to your code base if you are satisfied with them.

  3. If you run dcover create again after recompiling your project, Diffblue Cover will take into account the refactorings made, potentially producing more and better tests for your code base.

Note: Steps 1 and 2 can be performed jointly using dcover create --refactor.

Current limitations

Diffblue Cover Refactor currently only supports Maven projects. Gradle support will be provided soon.

Diffblue Cover Refactor currently only supports Java 8 and 11 projects. Java 17 support will be provided soon.

Diffblue Cover Refactor currently only supports the refactoring of R002. We will extend the support to refactorings of further output codes.