Prerequisites
- Diffblue Agents installed with an active license
- A supported AI coding agent platform installed and authenticated
Project requirements
- Java
- Python
| Requirement | Details |
|---|---|
| Build system | Maven or Gradle |
| Java version | 8+ |
| Testing framework | JUnit (4, 5, or 6) |
| Build state | Project compiles and existing tests pass |
| Version control | Git repository with a clean working tree |
You can use your AI coding agent platform to help fix failing tests before running the workflow.
Run the workflow
- Open a terminal at the root of your project.
- Trust the project directory if you have not already done so.
-
Create a branch for any environment setup changes:
-
Start the workflow:
What the workflow does
1. Prepare project
The workflow validates and configures your build environment. See the prepare project workflow for complete details. The workflow verifies your project is a git repository, detects build system and modules, validates the build environment, and adds missing dependencies. If any build configuration changes are needed, the workflow commits them in a single commit. The workflow only modifies build configuration files, never your source code or test files.2. Measure baseline coverage
The workflow measures coverage in an isolated git worktree. A worktree is a separate working directory linked to your repository that allows the workflow to measure coverage safely without affecting your current working directory. The workflow:- Creates a temporary worktree
- Runs your existing test suite
- Collects coverage data for each module
- Identifies untested or under-tested classes and methods
- Cleans up the worktree
3. Partition work
The workflow analyzes the coverage data to determine which classes need tests and how to group them into work units. The workflow identifies classes with coverage below the target threshold and optimizes work units to balance work across parallel workers while keeping related code together.4. Calculate resource estimates
The workflow provides estimates for the full test generation workflow:| Estimate | Description |
|---|---|
| Expected duration | Wall-clock time for the full test generation workflow |
| Token consumption | Estimated tokens your AI coding agent platform will consume |
| Units | Number of work units that will be processed in parallel |
5. Display summary
The workflow shows the planning results including baseline coverage per module, number of files and classes to be tested, and resource estimates for full test generation. Any modules that encountered errors during analysis are listed separately.Understanding the output
The workflow summary includes:| Field | Description |
|---|---|
| Modules analyzed | Number of modules successfully analyzed |
| Baseline coverage | Current line coverage before any test generation |
| Files to test | Number of source files identified as needing tests |
| Classes to test | Number of classes with coverage below threshold |
| Estimated duration | Expected time for full test generation |
| Estimated tokens | AI platform token consumption estimate |
| Units | Number of parallel work units |
Filter by module
For multi-module projects, you can limit planning to specific modules using the--module flag:
After running the workflow
- Review the resource estimates to decide if the token consumption and duration are acceptable for your use case.
- Review any build configuration changes. If the workflow committed changes to build files, verify the changes are appropriate.
- Check for module errors. If any modules failed analysis, fix the underlying issues before proceeding.
Troubleshooting
- Build verification fails: Ensure your project compiles and existing tests pass. See the project requirements for language-specific commands.
- Coverage measurement fails: Check that your project has the required coverage tools (JaCoCo for Java, pytest-cov for Python). The workflow adds these automatically during project preparation. Verify the tools are configured correctly.
- “Nothing to test” error: All your code is already fully covered by tests. No additional tests are needed.
- Module filter errors: Verify module paths are relative to the project root and match the structure detected during build system detection.
- See the troubleshooting page for more common issues.
Related workflows
Prepare project
Validate and configure build environment only
Generate tests
Run the full test generation workflow