# Generating tests

<mark style="color:green;">`GET`</mark> `/test/generate`

Use momentum to generate tests for your

**Headers**

| Name          | Value            |
| ------------- | ---------------- |
| Authorization | `Bearer <token>` |

**Query Params**

| Name            | Type   | Description                                                                                               |
| --------------- | ------ | --------------------------------------------------------------------------------------------------------- |
| `project_id`    | number | The project id generated during parsing of the code                                                       |
| `identifier`    | string | The node id that points to the specific endpoint you want to generate tests for, ex : `/server.py:search` |
| `endpoint_path` | string | Complete path of the endpoint you want to test                                                            |

**Response**

{% tabs %}
{% tab title="200" %}

```json
Generated Tests Cases in form of python code
```

{% endtab %}

{% tab title="400" %}

```json
{
    "detail": "Project Details not found."
}
```

{% endtab %}

{% tab title="500" %}
{% code overflow="wrap" %}

```json
Internal Server Error //usually occours when the identifier is wrong
```

{% endcode %}
{% endtab %}
{% endtabs %}

You can use the generated tests from this endpoint to test relevant code.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.momentum.sh/using-momentum/generating-tests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
