Cover Refactor - overview
Cover Refactor makes your code more testable.
Cover Refactor makes your code more testable - it suggests refactoring patches for your code that allow Diffblue Cover to create more and better tests for your project, and these suggestions can then be automatically applied to your code. Cover Refactor is integrated directly into Cover CLI and Cover Pipeline - no download or install needed.
Note that this topic focuses on Cover CLI - for information on using Cover Refactor with Cover Pipeline see Cover Pipeline.
Prefer video? No problem. Check out our getting started video.
Diffblue Cover generates 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, arefactorings.yml
file 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 usinggit diff
or similar, and then commit them to your code base when you're happy. - 3.If you run
dcover create
again after recompiling your project, Diffblue Cover will take the refactorings into account, potentially producing more and better tests for your code base.
Note: Steps 1 and 2 can be performed jointly using
dcover create --refactor
Diffblue Cover Refactor currently only supports:
- Java 8 to Java 17 projects.
- Refactoring of R002 - Missing observers, E027 - JUnit Jupiter Engine not found, E052 - Missing dependency, E086 - Specified test framework not available, E118 - JUnit Vintage Engine not found or E137 - Mockito JUnit Jupiter is not configured output codes. Future releases will expand this output code set.
Last modified 23d ago