Introduction:
DiffBlue Cover is an AI-powered automated testing tool that helps software developers create tests automatically for their Java code. One of the key features of DiffBlue Cover is its Cover Plugin, which integrates seamlessly with popular integrated development environments (IDEs) like Eclipse and IntelliJ IDEA. The Cover Plugin enables developers to test their code quickly and easily, without having to leave their IDE. This documentation will guide you through the installation and usage of DiffBlue Cover Plugin.
Prerequisites:
- Java Development Kit (JDK) version 8 or later(Tried on Java 11)
- Eclipse IDE or IntelliJ IDEA
- Add JUnit 4 or later dependency to your pom.xml or build.gradle
Installation:
- Download the latest version of DiffBlue Cover from the official website https://www.diffblue.com/plugin
- Directly in Intellij Idea you can Install it from Plugin Marketplace.
- Select "Diffblue Cover" from the list of available plugins and click "Next".
- Follow the instructions provided by the installer to complete the installation process.
Icons:
Write tests
Click on the icon to write tests for this method or class.
Private method
This method cannot be tested as it is private but it may be tested indirectly via a public method. Please make this method public or package protected if you would like to write unit tests.
Usage:
Once you have installed the DiffBlue Cover Plugin, you can start using it to create tests for your Java code.
- Open the Java class you want to test in Eclipse or IntelliJ IDEA.
- Here Few Snapshots for auto generated test cases by Diffblue cover plugin
Limitation:
- Diffblue Cover is a tool that automatically generates unit tests for Java code. However, like any tool, it has some limitations.
- One limitation is compatibility. Diffblue Cover may not work with all versions of Java or third-party libraries that your code depends on.
- When testing GRPC Controller level, it cannot test StreamObserver using StreamRecorder.GRPc support is very limited.
- The environment configuration is very specific,It works only on java 8,11 and 17.So you might need to change the java version which can be tedious depending on the complexity of the project.
- Diffblue Cover generates tests based on the code paths it can observe during execution, which means it may miss some code paths that are not executed during the generation process. This can result in incomplete test coverage.
- While Diffblue Cover can generate valid unit tests, the quality of the tests can vary depending on the complexity of the code being tested. In some cases, manual refinement of the generated tests may be necessary to ensure that they accurately test the desired behavior.
- Like all automated tools, Diffblue Cover is not perfect, and it can produce false positives (tests that fail even though the code is correct) and false negatives (tests that pass even though the code is incorrect).
- DiffBlue Cover is primarily focused on generating functional tests that validate the behavior of the code. It may not be able to generate tests that validate non-functional requirements, such as performance or security.


