Diffblue Cover Refactor

Automatically make Java code more testable

Automatic code improvement

Diffblue Cover Refactor is a code optimization tool that improves unit test coverage and reduces the need for unproductive developer effort. Refactor automatically improves the testability of Java source code to decrease the risk of errors when changes are made. 

Cover Refactor uses AI to suggest and apply code fixes that improve the observability of Java code and make it more testable. It can even make these changes automatically, without any input from your team, letting you reduce the risk of change and get more value from unit testing.

But Refactor doesn’t just make code more testable - it also increases code coverage by default. Unit tests for newly testable code are automatically written the next time Cover is used to update your unit test suite.

Better code

Cover Refactor improves the quality of your Java source code with zero additional development effort. This code is easier to test, maintain and enhance.

More coverage

Cover Refactor increases unit test coverage by default. The act of making more code testable means Cover Core can automatically write more unit tests.

Reduce regressions

Risk is the heart of the matter. More testable code and higher unit test coverage reduce the risk of regressions when code changes are made - especially in complex legacy applications.

Focus effort

There’s too much code to write and not enough people to do it, so it’s hard to prioritize improvements to old code over productive new development. Refactor does some of the work for you.

Understand testability

The analysis performed by Cover Core is the basis of Refactor’s capabilities. Cover can visualize exactly how big the problem of untestable code is, and pinpoint specific issues to solve - no easy task in a large codebase.

Automatic Refactoring

This simple example shows how Cover Refactor can increase testability by improving observability. A method is testable when you can fully control the inputs and fully observe all of the side-effects of the method call. The private field `counter` is not observable by the unit test, so a unit test cannot be written.

Once Cover Refactor has added the public getter, Cover Core can automatically write an effective unit test.

Ready to try Diffblue Cover?

Try free for 14 days


What is Diffblue Cover?

Diffblue Cover creates suites of unit tests that run in your continuous integration pipeline between versions and protect against regressions, so you can catch errors faster and earlier in the software development lifecycle. To learn more, see our our product page.

What are the benefits of using Diffblue Cover?

Diffblue Cover helps your team increase automation of your CI pipeline.

For development teams, this:

  • improves velocity and quality of the software you deliver
  • frees up time to focus on creating new features

For DevOps teams, this:

  • helps catch errors and issues earlier (shift left!)
  • improves deployment frequency, lead time, and mean time to repair (MTTR)

Will the tests find regressions in my code?

Yes. Diffblue Cover quickly generates tests that will allow you to adopt CI. The generated tests will help developers quickly identify regressions in subsequent commits before committing new versions.

What are the requirements for running Diffblue Cover?

See the product datasheet for more information.

How can I learn more about customers using Diffblue Cover?

See our case study on how Goldman Sachs has benefited from using Diffblue Cover to increase coverage and create a safety net against regressions.

For example of other ways our customers use Diffblue Cover, click here.

How do we maintain Diffblue unit tests in the future?

Diffblue regression suites are maintained automatically and updated with each new code version to capture the current behavior of the code.

How does Diffblue Cover help me adopt Continuous Integration?

Diffblue Cover AI analyzes your code and writes Java unit tests that run in a CI pipeline after each commit. Cover’s tests:

  • Always compile
  • Run quickly
  • Detect regressions from previous versions
  • Improve coverage
  • Are easy to understand

Should our team stop writing unit tests after adopting Diffblue Cover?

No. Diffblue Cover is meant to complement your own unit tests and help you catch regressions.

How is a unit test different from a Diffblue regression suite?

Developers write individual unit tests to test specific functionality. Diffblue regression suites are generated automatically to help find regressions early in the development cycle. Find out more in our Unit Regression Tests eBook.