Skip to main content
Run this workflow to validate your project setup, preview build configuration changes, or catch environment issues before running test generation. The workflow adds missing dependencies and configures build tools without generating tests or measuring coverage.
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

Project requirements

RequirementDetails
Build systemMaven or Gradle
Java version8+
Version controlGit repository
The workflow helps identify and resolve build issues.

Run the workflow

  1. Open a terminal at the root of your project.
  2. Trust the project directory if you have not already done so.
  3. Create a branch for the environment setup changes:
    git checkout -b diffblue-agents-setup
    
  4. Start the workflow:
    diffblue-agents run regression-unit-tests-prepare-project
    

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:
  1. Creates a temporary worktree
  2. Pre-creates test directories for test generation
  3. Validates the build environment by checking for required dependencies
  4. Adds missing dependencies to build configuration files
  5. Commits valid changes and cherry-picks the changes back to your branch
  6. Cleans up the temporary worktree
For Python projects, the workflow also:
  • 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:
  • pom.xml (Maven projects)
  • build.gradle / build.gradle.kts (Gradle projects)
  • .gitignore (to exclude generated files)
All changes are committed in a single commit with a descriptive message listing what was added or modified.
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:
DependencyPurpose
JUnitTesting framework
MockitoMocking library
JaCoCoCoverage reporting
The workflow may upgrade existing dependencies, if necessary.

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
If no changes were needed, the workflow completes with no modifications.

After running the workflow

  1. Review the commit to verify the changes are appropriate for your project.
  2. If you need to adjust the changes, modify the build configuration files and amend the commit.
Your project environment is now configured for test generation.

Next steps

Troubleshooting

  • Git repository check fails: Ensure you are running the command from a git repository. Initialize one with git init if needed.
  • Build system detection fails: Verify you have a valid pom.xml, build.gradle, or pyproject.toml file 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.