The prepare project workflow runs automatically as the first step of the planning workflow and the full test generation workflow. Run the prepare project workflow independently only if you want to validate your environment setup without proceeding to planning or test generation.
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+ |
| Version control | Git repository |
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 the environment setup changes:
-
Start the workflow:
What the workflow does
1. Verify git repository
The workflow verifies the project is a git repository. The workflow aborts if this check fails.2. Detect project configuration
The workflow analyzes your project to identify:- Build system (Maven, Gradle, or Python build tools)
- Project modules and structure
- Source and test directories
- Testing framework (if present)
- Existing dependencies
3. Validate and configure build environment
The workflow validates and configures your build environment in an isolated git worktree. The workflow:- Creates a temporary worktree
- Pre-creates test directories for test generation
- Validates the build environment by checking for required dependencies
- Adds missing dependencies to build configuration files
- Commits valid changes and cherry-picks the changes back to your branch
- Cleans up the temporary worktree
- Removes stale virtual environments from the worktree
- Copies the virtual environment from the worktree back to your source repository
- Repairs virtual environment paths to work in the source location
4. Display summary
The workflow shows a summary of changes made to your build configuration.What files can be modified
The workflow only commits changes to build configuration files. The workflow never changes your source code or test files. Build configuration files that may be committed:- Java
- Python
pom.xml(Maven projects)build.gradle/build.gradle.kts(Gradle projects).gitignore(to exclude generated files)
For Python projects, the workflow also creates or updates a
.venv directory in your project root. The virtual environment files are not committed to git (they are excluded via .gitignore).Dependencies that may be added
The workflow ensures your project has the minimum dependencies required for test generation:- Java
- Python
| Dependency | Purpose |
|---|---|
| JUnit | Testing framework |
| Mockito | Mocking library |
| JaCoCo | Coverage reporting |
Understanding the output
When the workflow completes, you see:- Build environment changes — A list of modifications made (e.g., “Added JUnit 5.10.0”, “Added JaCoCo Maven plugin”)
- A new commit — The commit contains any modifications, with a descriptive message
After running the workflow
- Review the commit to verify the changes are appropriate for your project.
- If you need to adjust the changes, modify the build configuration files and amend the commit.
Next steps
- Run the planning workflow to measure coverage and preview resource estimates
- Run the regression unit test generation workflow to generate tests
Troubleshooting
- Git repository check fails: Ensure you are running the command from a git repository. Initialize one with
git initif needed. - Build system detection fails: Verify you have a valid
pom.xml,build.gradle, orpyproject.tomlfile in your project root or module directories. - Changes not applied: Check that you don’t have uncommitted changes that conflict with the build configuration files. Commit or stash your changes before running the workflow.
- See the troubleshooting page for more common issues.