> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diffblue.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test quality report

> Assess test quality with coverage, mutation score, and test strength metrics

Run this workflow to measure test coverage, mutation score, and test strength across your project. The report breaks down metrics per module and per class.

## Prerequisites

* Diffblue Agents [installed](/installation) (no license required)
* A [supported AI coding agent platform](/system-requirements#supported-ai-coding-agent-platforms) installed and authenticated

## Project requirements

<Tabs>
  <Tab title="Java">
    | Requirement       | Details                                                                                                                                               |
    | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Build system      | Maven 3.8.6+ or Gradle 8.4+                                                                                                                           |
    | Java version      | 8+                                                                                                                                                    |
    | Testing framework | JUnit (4, 5, or 6)                                                                                                                                    |
    | Mutation testing  | Automatically configured ([PIT](https://pitest.org/)); the appropriate PIT version and JUnit plugin are selected based on your project's Java version |
    | Build state       | Project compiles and existing tests pass                                                                                                              |
    | Version control   | Git repository with a clean working tree                                                                                                              |
  </Tab>

  <Tab title="Python (Experimental)">
    | Requirement       | Details                                                                                                                                                |
    | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
    | Python version    | 3.7+ (Linux/macOS); 3.7-3.12 (Windows, 3.13+ unsupported)                                                                                              |
    | Testing framework | pytest                                                                                                                                                 |
    | Mutation testing  | Automatically configured ([mutmut](https://mutmut.readthedocs.io/)); the appropriate mutmut version is selected based on your project's Python version |
    | Build state       | Existing tests pass                                                                                                                                    |
    | Version control   | Git repository with a clean working tree                                                                                                               |
  </Tab>
</Tabs>

## Run the workflow

```bash theme={null}
diffblue-agents run test-quality-report
```

The workflow:

1. Detects your build system, language, and modules
2. Configures coverage and mutation testing tools if not already present
3. Runs coverage and mutation analysis
4. Displays a per-module quality report

## Filter by module

Limit the assessment to specific modules with `--module`:

```bash theme={null}
diffblue-agents run test-quality-report --module apps/server
```

## Filter by package or class

Scope the assessment to a specific package or class with `--filter`:

```bash theme={null}
diffblue-agents run test-quality-report --filter com.example.payments
```

## Understanding the report

The report shows four metrics for each module and class:

| Metric              | Meaning                                                                              |
| ------------------- | ------------------------------------------------------------------------------------ |
| **Line coverage**   | Percentage of code lines executed by tests                                           |
| **Branch coverage** | Percentage of code branches (if/else, switch) executed by tests                      |
| **Mutation score**  | Percentage of code mutations detected by tests (killed mutants / total mutants)      |
| **Test strength**   | Percentage of covered mutations detected by tests (killed mutants / covered mutants) |

### What the metrics tell you

* **High line coverage, low mutation score**: Your tests run the code but don't verify its behavior. Assertions may be missing or too weak.
* **Low line coverage, high test strength**: The code that is covered is tested effectively, but not enough code is actually covered.
* **Low line coverage**: Parts of your code aren't reached by any test.

## Tool configuration

The workflow automatically configures mutation testing tools if they are not already present:

* **Java**: Adds the [PIT (Pitest)](https://pitest.org/) Maven or Gradle plugin
* **Python**: Installs [mutmut](https://mutmut.readthedocs.io/) in the virtual environment

Tool configuration changes are committed to your repository only after a successful run. On subsequent runs, the tools are already configured and the workflow skips this step.

## Next steps

Address gaps identified in the report by running the Diffblue Testing Agent:

```bash theme={null}
diffblue-agents run regression-unit-tests
```
