Automatically make Java code more testable
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.
Cover Refactor improves the quality of your Java source code with zero additional development effort. This code is easier to test, maintain and enhance.
Cover Refactor increases unit test coverage by default. The act of making more code testable means Cover Core can automatically write more unit tests.
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.
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.
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.
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.
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.
Diffblue Cover helps your team increase automation of your CI pipeline.
For development teams, this:
For DevOps teams, this:
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.
See the product datasheet for more information.
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.
Diffblue regression suites are maintained automatically and updated with each new code version to capture the current behavior of the code.
Diffblue Cover AI analyzes your code and writes Java unit tests that run in a CI pipeline after each commit. Cover’s tests:
No. Diffblue Cover is meant to complement your own unit tests and help you catch regressions.
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.