Skip to main content

Prerequisites

Project requirements

Your project must meet the following requirements before running the workflow.
RequirementDetails
Build systemMaven or Gradle
Java version8–25
Testing frameworkJUnit (4, 5, or 6)
Build stateProject compiles and existing tests pass
Version controlGit repository with a clean working tree
Verify that your project builds and existing tests pass:
mvn clean compile && mvn test
You can use your AI coding agent platform to help configure JaCoCo, add Mockito, or fix failing tests before running the workflow.

Run the workflow

Agents automatically detects the project language, build system, and test framework.
  1. Open a terminal at the root of your project.
  2. Ensure your AI coding agent has trusted the project directory. Open your agent in the project root and approve the trust prompt if you have not already done so:
    claude
    
  3. Create a branch for the generated tests:
    git checkout -b diffblue-agents-tests
    
    Creating a dedicated branch keeps your main branch clean and lets you review the tests before merging.
  4. Start the workflow:
    diffblue-agents run regression-unit-tests
    
  5. Diffblue Agents displays a resource estimate including expected duration and estimated AI coding agent platform cost, then continues automatically. Cost estimates are indicative — actual costs depend on your subscription with the AI coding agent platform.

Preview the workflow

To validate your project setup and preview the scope of work before running the full workflow:
diffblue-agents run regression-unit-tests-planning
This runs the planning phase only. It detects your build system, measures baseline coverage, partitions the work, and provides a resource estimate (expected duration and estimated AI coding agent platform cost). No tests are generated or committed. Use this to catch environment issues early or to review the estimated cost before committing to a full run. Cost estimates are indicative — actual costs depend on your subscription with the AI coding agent platform.

What the regression-unit-tests workflow does

The regression-unit-tests workflow runs through the following stages:
  1. Plan — detects the project configuration, validates the build environment, measures baseline coverage, and determines what needs testing. This is the same phase that runs when you use regression-unit-tests-planning above.
  2. Generate tests — for each partition, Diffblue Agents:
    • Plans test generation for the target code
    • Delegates test writing to your AI coding agent platform
    • Compiles and runs the generated tests
    • Validates that tests pass and improve coverage
    • Commits passing tests
    • Rolls back tests that fail validation
All test generation runs in temporary git worktrees.
  1. Cherry-pick and report — cherry-picks committed tests to your branch and displays a summary.

Understand the results

When the workflow completes, the summary includes:
FieldDescription
Tests generatedTotal number of tests written by the agent platform
Files processedNumber of source files that were targeted for test generation
Line coverage beforeBaseline line coverage before the workflow ran
Line coverage afterLine coverage after committed tests are included
DurationTotal workflow execution time
A high rollback count is normal. Diffblue Agents validates every test strictly — only tests that compile, pass, and improve coverage are kept.

Troubleshooting

  • If the workflow fails during validation, verify that your project builds and tests pass before re-running. See the project requirements for language-specific commands.
  • If cherry-pick conflicts are reported, you made changes to the same files while the workflow was running. Resolve conflicts with standard git conflict resolution.
  • See the troubleshooting page for more common issues.