> For the complete documentation index, see [llms.txt](https://docs.testvibe.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.testvibe.com/ai-generation.md).

# Generate Tests With AI

AI generation helps you turn readable test intent into runnable browser automation.

In TestVibe, generation usually starts from a Gherkin feature or a new feature idea. The selected AI agent uses your instructions, target site, and project settings to create or update test output in your project.

## What You Can Generate

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>New feature intent</strong></td><td>Draft or expand a feature from a group, target site, and user goal.</td><td><a href="/pages/stxKNhL7uWZmaodVHNrR">/pages/stxKNhL7uWZmaodVHNrR</a></td></tr><tr><td><strong>Playwright code</strong></td><td>Create runnable browser automation from an existing feature file.</td><td><a href="/pages/EIYfDcimXldXAsAbHFsJ">/pages/EIYfDcimXldXAsAbHFsJ</a></td></tr><tr><td><strong>Improved output</strong></td><td>Regenerate after editing instructions, fixing setup, or reviewing a weak result.</td><td><a href="/pages/WbcTvI2b0hgpBj8Y9in6">/pages/WbcTvI2b0hgpBj8Y9in6</a></td></tr><tr><td><strong>Recovery guidance</strong></td><td>Understand common failures and decide what to fix next.</td><td><a href="/pages/oBXwqG3IkVdplkt0lUct">/pages/oBXwqG3IkVdplkt0lUct</a></td></tr></tbody></table>

## What AI Generation Does

| It can help with            | What that means                                                     |
| --------------------------- | ------------------------------------------------------------------- |
| Drafting feature behavior   | Turn a user goal into clearer Gherkin scenarios.                    |
| Generating Playwright code  | Create executable browser automation from saved test intent.        |
| Using target site context   | Inspect or interact with the site while building the test.          |
| Producing progress evidence | Show sections, steps, screenshots, run status, and generated paths. |
| Iterating on tests          | Regenerate after you improve the instructions or setup.             |

## What AI Generation Does Not Replace

AI generation does not remove the need to review tests.

You still decide:

* whether the Gherkin describes the right behavior
* whether the generated code checks the right outcome
* whether test data and credentials are safe and repeatable
* whether a failure means the app is broken, the test is wrong, or the setup is incomplete

## Before You Generate

Make sure the project has:

| Requirement          | Why it matters                                                                        |
| -------------------- | ------------------------------------------------------------------------------------- |
| Saved feature intent | Generation needs clear behavior to turn into code.                                    |
| Target site URL      | The agent and the cloud test session need a site to inspect or run against.           |
| Available credits    | Generation runs on TestVibe’s metered AI service and stops when the balance runs out. |
| Site reachability    | The cloud test session must be able to reach the target site.                         |

## Start Here

New to generation? Read [How AI generation works](/ai-generation/how-ai-generation-works.md), then continue to [Generate Playwright code](/ai-generation/generate-playwright-code.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.testvibe.com/ai-generation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
