The Best Ways to Use Diffblue Cover for Big Codebases

Hello Everyone :hugs:,

Diffblue Cover is a fantastic tool that I recently started using to automatically generate unit tests in Java. But I’m working with a really big and complicated codebase right now, and I’m having some difficulties that I’m hoping the community can help me with.

Problems with Performance: Although Diffblue Cover performs admirably on smaller projects, I’ve observed certain performance lags when using it on bigger code bases. When creating tests for a larger project, are there any best practices or configurations that can help maximise performance? Is it better to work on smaller modules first, or is it possible to manage the full codebase at once with efficiency? :thinking:

Managing Old Code: There isn’t much documentation and a large portion of the codebase I work with is legacy code. Has anyone successfully generated tests for ancient systems automatically using Diffblue? If so, do you have any advice on how to increase precision or handle edge instances that the tool might have trouble with? :thinking:

Integration with Continuous Integration/Continuous Delivery (CI/CD): Including Diffblue Cover in our CI/CD workflow is something else I’m interested in doing. To what extent does it work with popular CI/CD tools such as Travis, GitLab CI, and Jenkins? To guarantee a seamless integration, are there any specific actions or setups I should be aware of? :thinking:

I would be grateful for any guidance, suggestions, or firsthand accounts. Anticipating gaining knowledge from the experiences and ccsp perspectives of the community!

Thank you in advance for your help and support.

Hi Peter12,

I’m going to give some quick responses, but not go into great detail.

Performance This may depend on your project, system, Cover usage (plugin or CLI), and other factors. If you could give some more information here that may be helpful. That said, For large/complex projects usually using the CLI is best.

Legacy Projects Yes, Diffblue Cover has been used on legacy codebases many times. Generally precision and edge cases can be handled with a little care of how they occur. Options such as using custom rules can be very helpful here (documentation here).

Integration with CI/CD Diffblue easily integrates with CI/CD, details on how to do so for GitHub/GitLab/Jenkins/etc. can be found under the Cover Pipeline documentation.

To effectively use Diffblue Cover for big codebases:

  1. Start with Critical Components: Focus on high-priority modules or core parts of your application that require robust testing first.
  2. Incremental Adoption: Gradually introduce Diffblue Cover into your CI/CD pipeline, adding coverage for new code or untested areas over time.
  3. Leverage Automated Test Generation: Let Diffblue Cover automatically generate unit tests for large portions of your codebase, especially for legacy code or complex systems.
  4. Review & Refine: After generating tests, review and refine them to ensure they cover edge cases and match your testing requirements.
  5. Integrate with Existing Test Suites: Use Diffblue Cover in tandem with your existing test frameworks to expand test coverage without disrupting current processes.

This approach helps ensure comprehensive test coverage without overwhelming your team with manual test writing.

To use Diffblue Cover effectively for big codebases:

  1. Automate Unit Test Generation: Use Diffblue Cover to automatically generate unit tests for large or legacy code, saving time and improving test coverage.
  2. Focus on Critical Areas: Start by generating tests for high-risk or frequently modified parts of the codebase.
  3. Integrate with CI/CD: Set up Diffblue Cover in your CI/CD pipeline to continuously generate and update tests as code evolves.
  4. Refactor with Confidence: Use the tests to ensure your changes don’t break existing functionality, especially in complex or critical modules.

This will help improve test coverage and maintainability in large codebases.