# 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 repository settings to create or update test output in GitHub.

## 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, workflow 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 runner need a site to inspect or run against.                              |
| AI agent key when required | Some providers need a repository secret such as `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`. |
| Runner access              | GitHub Actions needs a runner that can reach the site.                                   |
| Repository permissions     | TestVibe needs permission to write generated files and read workflow status.             |

## 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: 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.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.
