create
Generate JUnit tests for Java classes, methods, or packages by running Diffblue Cover CLI. Specify entry points or test the entire project.
Instructions
Invoke Diffblue Cover to generate unit tests for Java code.
This tool executes the dcover CLI to automatically generate JUnit tests for the specified Java classes, methods, or packages. It supports various configuration options to control the test generation process.
Args: path: Path to the dcover executable. If not provided, searches system PATH and the DIFFBLUE_COVER_CLI environment variable. working_directory: Root directory of the Java project to test. Defaults to the current working directory. dcover_timeout: Maximum execution time in seconds. Defaults to 600. Set to None for no timeout (not recommended). entry_points: List of fully-qualified Java targets (packages, classes, or methods) to generate tests for. Examples: ['com.example.MyClass', 'com.example.MyClass.myMethod']. If None, tests entire project. args: Additional arguments to pass to dcover. Defaults to None. ctx: MCP server context for logging and progress reporting (auto-injected by FastMCP).
Returns: dict: Execution result containing: - return_code (int): Exit code (0 for success) - status (str): "success" if completed without errors - output (str): Complete stdout/stderr from dcover - command (list[str]): The exact command that was executed - working_directory (Path): Directory where command was run
Raises: ToolError: If dcover executable not found, command fails, or timeout exceeded. The error includes the partial output collected before failure.
Note: If DIFFBLUE_COVER_OPTIONS environment variable is set, it overrides all option parameters (batch, skip_verification, etc.) except path, working_directory, timeout, and entry_points.
This tool requires a valid Diffblue Cover license. See:
https://docs.diffblue.com/features/cover-cli/commands-and-arguments#create-testsInput Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | The options to pass to dcover | |
| path | No | The path to the dcover executable | |
| entry_points | No | The list of package names, class names, and/or methods to write tests for. The entries here should be fully qualified, in other words you must include the package and class names when specifying a method name. | |
| dcover_timeout | No | The maximum time in seconds to wait for dcover to create tests. | |
| working_directory | No | The directory containing the project | /app |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |