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

# Generate tests

<Badge color="outline-provider" size="sm" shape="pill" icon="github">GitHub</Badge>
<Badge color="outline-provider" size="sm" shape="pill" icon="gitlab">GitLab</Badge>

<Warning>
  **Git Integration (formerly Qodo Merge)** – AI code review agents for pull requests. This documentation describes the Qodo v1 experience. For the Qodo v2 documentation, click [here.](/code-review)
</Warning>

The `test` tool generate tests for a selected component, based on the PR code changes.

The `test` tool supports the programming languages: Python, Java, C++, JavaScript, TypeScript, C#.

## How to use the `test` tool

This tool can also be triggered interactively by using the [`analyze`](/v1/tools/tools-list/analyze) tool.

**Manual usage**

Comment on the PR:

```bash theme={null}
/test component_name
```

The tool will generate tests for the selected component.

If no component is selected, `test` will generate tests for largest component.

### Choosing components

You can set the component name as the name of a specific component in the PR.

To get a list of the components that changed in the PR and select the relevant component interactively, use the [`analyze`](/v1/tools/tools-list/analyze) tool.

## Configuration options

Configure the `test` tool by setting configurations under the `pr_test` part in your [configuration file](/v1/configuration/configuration-file/).

| Possible configurations | Default value                                                                                                       | What they do                                                                                                                                                                                           |
| :---------------------- | :------------------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `num_tests`             | `3`                                                                                                                 | Number of tests to generate.                                                                                                                                                                           |
| `testing_framework`     | For Python: `pytest`,<br /> For Java: `JUnit`,<br />  For C++: `Catch2`, <br /> For JavaScript & TypeScript: `jest` | The testing framework to use.                                                                                                                                                                          |
| `avoid_mocks`           | `true`                                                                                                              | If set to true, the tool will try to avoid using mocks in the generated tests. Note that even if this option is set to true, the tool might still use mocks if it cannot generate a test without them. |
| `extra_instructions`    | none                                                                                                                | Optional extra instructions for the tool. For example: "focus on the changes in the file X", "Ignore changes in ..."                                                                                   |
| `file`                  | none                                                                                                                | Lets you specify a relevant file in case there are several components with the same name.                                                                                                              |
| `class_name`            | none                                                                                                                | Lets you specify a relevant class name in case there are several methods with the same name in the same file.                                                                                          |
| `enable_help_text`      | `true`                                                                                                              | If set to true, the tool will add a help text to the PR comment.                                                                                                                                       |

## Example usage

<Frame>
  <img src="https://mintcdn.com/qodo/uIkZ6kAWHm6WXqrW/images/v1/image-176.png?fit=max&auto=format&n=uIkZ6kAWHm6WXqrW&q=85&s=39c1c1a294839c772f830eb3b47dca95" alt="" width="825" height="904" data-path="images/v1/image-176.png" />
</Frame>
