# Generate a new feature

Generate a new feature when you know what behavior you want to cover but do not want to write the first Gherkin draft from scratch.

TestVibe can help turn a user goal into a feature file with scenarios and steps that you can review, edit, and generate into Playwright code.

## Before You Start

Prepare:

| Item            | Why it matters                                                      |
| --------------- | ------------------------------------------------------------------- |
| Target group    | The feature needs a place in the Test Suite.                        |
| Feature goal    | The agent needs a clear behavior to draft.                          |
| Target site URL | Generation may inspect or reason about the application.             |
| AI agent key    | Some agents require a configured repository secret.                 |
| Test data       | The scenario should use repeatable data or explain how to reach it. |

## Steps

1. Open the **Test Suite**.
2. Select the group where the new feature belongs.
3. Choose the action to create or generate a feature.
4. Describe the behavior you want to cover.
5. Confirm the target site URL.
6. Start generation.
7. Watch the generation progress view.
8. Review the generated feature before relying on it.

If TestVibe opens an editable draft first, improve the draft before starting generation.

## Write A Good Feature Request

Good requests are specific:

| Good                                                                                        | Too vague               |
| ------------------------------------------------------------------------------------------- | ----------------------- |
| `Create a feature for an admin inviting a new team member and seeing a success message.`    | `Test admin stuff.`     |
| `Cover filtering invoices by overdue status and verifying only overdue invoices are shown.` | `Check invoices.`       |
| `Generate a password reset scenario for a valid email address.`                             | `Password reset works.` |

Include the visible outcome that proves success.

## Review The Draft

After generation, check:

| Review       | Question                                           |
| ------------ | -------------------------------------------------- |
| Feature name | Does it describe the product behavior clearly?     |
| Scenarios    | Is each scenario focused on one outcome?           |
| Steps        | Are the steps visible and repeatable?              |
| Assertions   | Does every scenario prove something with a `Then`? |
| Test data    | Can the data exist every time the test runs?       |

Edit the feature before generating Playwright code if the intent is not right yet.

## Next

When the feature reads well, continue to [Generate Playwright code](/ai-generation/generate-playwright-code.md).


---

# 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.testvibe.com/ai-generation/generate-new-feature.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.
