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

# Plan Generation & Editing

> How TestSprite turns explored features into a UI test plan grounded in real observed flows, and how to review, prune, refine, and add to it before generation runs.

![Review proposed tests: cases grouped by use case, nothing added until you confirm](https://mintcdn.com/testspriteinc/CImpC64Ju-sB5348/images/ui-testing-plan-gen-Overview.png?fit=max\&auto=format\&n=CImpC64Ju-sB5348\&q=85\&s=337558e90b558873476ad14f3014f152)

## What Plan Generation Does

TestSprite's testing agent takes what [Feature Exploration](https://docs.testsprite.com/web-portal/core/ui/feature-exploration.md) observed in your app and plans test cases for each feature. The plan is what you review and edit before any test code is written.

> [card]
>
> ```mermaid theme={null}
> flowchart LR
>     A[Feature Exploration<br/>live walks of your app] --> M[Feature map<br/>features · use cases] --> B[Plan Generation]
>     B --> C[Flow-grounded test cases<br/>title · description · steps · priority]
>     C --> D{Your review<br/>edit · prune · add}
>     D -->|Run all| E[UI test code<br/>Python + Playwright]
> ```

UI plans are **flow-grounded**: each case follows a sequence of clicks, fills, and assertions the agent saw work during exploration, using your real button labels, URLs, and form fields. A plan row reads like *"Verify a new user can sign up with a valid email and lands on the welcome screen"*.

> [!NOTE]
>
> **Nothing runs during plan generation.** No browser actions are issued.

## What Goes Into the Plan

| Input | Where it comes from | How it's used |
| :- | :- | :- |
| <kbd>Explored features</kbd> | [Feature Exploration](https://docs.testsprite.com/web-portal/core/ui/feature-exploration.md) | One sub-plan per feature, with cases grounded in observed flows |
| <kbd>PRD / extra context</kbd> | The New Project form's **Extra Context** step | Shapes what's "in scope" vs "out of scope" |
| <kbd>Test account credentials</kbd> | The New Project form's **Access details** step | Inform how authenticated paths get tested |
| <kbd>Feature map</kbd> | [Test Coverage](https://docs.testsprite.com/web-portal/core/working-with-test/coverage-map.md), built from your PRD and exploration | Groups and scopes the tests by use case, and shows which features connect |

Features exploration couldn't reach get [spec-based cases](#spec-based-cases-fallback-for-unexplored-features) instead.

## The Plan Structure

Each plan row is one test case with a **title**, **description**, and **priority**, plus a step list (Actions such as clicks, fills, and navigations, and Assertions to verify) revealed with the **Show flow** toggle.

![A plan row with priority, test name, description, and its step flow expanded](https://mintcdn.com/testspriteinc/CImpC64Ju-sB5348/images/ui-testing-plan-gen-structure.png?fit=max\&auto=format\&n=CImpC64Ju-sB5348\&q=85\&s=54ca2bd2dab694dadfa1dbd58c6eac35)

Case count varies with the feature: a simple "Forgot Password" might get a couple of cases, a complex "Checkout" 10 or more.

## Reviewing the Plan

The plan view lists cases grouped by use case. Each row shows checkbox · No. · priority · title · description.

**1. Read the description, then Show flow if you need detail**

The description is what drives generation. Click **Show flow** to see the Action / Assertion list; you can edit a step's text right there.

![A plan row with Show steps expanded, revealing its Action / Assertion list](https://mintcdn.com/testspriteinc/CImpC64Ju-sB5348/images/ui-testing-plan-gen-view.png?fit=max\&auto=format\&n=CImpC64Ju-sB5348\&q=85\&s=6c579ba2723c520436c042ed3fe8be15)

**2. Untick anything you don't want**

Each row's checkbox toggles one case; the header checkbox is **Select All**.

![Per-row checkboxes and the header Select All toggle](https://mintcdn.com/testspriteinc/CImpC64Ju-sB5348/images/ui-testing-plan-gen-uncheck.png?fit=max\&auto=format\&n=CImpC64Ju-sB5348\&q=85\&s=9f8c88f3dc749819eda28934cfdb9f83)

**3. Edit titles and descriptions**

**Test Name** and **Test Description** are plain text inputs, and your edits feed straight into generation.

![Test Name and Test Description edited directly as text inputs](https://mintcdn.com/testspriteinc/CImpC64Ju-sB5348/images/ui-testing-plan-gen-edit.png?fit=max\&auto=format\&n=CImpC64Ju-sB5348\&q=85\&s=ca907e4c57a44721b839cd637396464e)

**4. Adjust priority if you want a case run first**

Each row has a Priority dropdown (default **Medium**). Higher-priority cases run earlier.

![Priority dropdown on a plan row](https://mintcdn.com/testspriteinc/CImpC64Ju-sB5348/images/ui-testing-plan-gen-priority.png?fit=max\&auto=format\&n=CImpC64Ju-sB5348\&q=85\&s=486b875f060abef3faf30c69e1f6d9e4)

**5. Add a custom case**

Click **+ More Test Case** at the bottom of the list (suffixed with the use case's name) and fill in the new row. It's generated with the rest.

![+ More Test Case button adding an empty row at the bottom of the list](https://mintcdn.com/testspriteinc/CImpC64Ju-sB5348/images/ui-testing-plan-gen-custom.png?fit=max\&auto=format\&n=CImpC64Ju-sB5348\&q=85\&s=3702d87af05234e7e2f73b751b47ff3f)

> [!TIP]
>
> **Selecting all is usually right on a first run.** Pruning makes runs faster but doesn't change correctness.

## Adding and Refining in Natural Language

Ask in **Chats** to add a case or change several at once. TestSprite works out which feature the request applies to and updates the plan; you can review or undo before clicking **Run all**.

```text Add theme={null}
Add a test for the Cart feature: user adds 3 items, then removes 1, then verifies the count is 2 and the total updates correctly.
```

```text Refine theme={null}
Make the Login tests more strict about error messages: assert the exact error text, not just that "an error appears".
```

A case added for an explored feature inherits its observed selectors and flow; otherwise it's spec-based.

## What "Run all" Triggers

Clicking **Run all** adds the cases and starts the first run, which generates and runs each test. The plan is frozen at click time; later edits require a re-generation.

> [card] [UI Test Generation & Execution](https://docs.testsprite.com/web-portal/core/ui/ui-test-gen.md)
>
> Each plan case becomes a runnable Python + Playwright test

## Spec-Based Cases (Fallback for Unexplored Features)

When exploration couldn't reach a feature (paywall, login failure, transient error), the plan for it is **derived from your description and extra context** instead of a real walk. These cases are best-effort:

* **Selectors or button labels may be wrong**, since there's no observed flow to ground them
* **They may miss flows you have**, since only what you described is in the plan
* **They still run**: selectors are resolved against the live DOM at run time

If one fails on its first run, refine it with the actual UI labels and TestSprite rewrites the test against the real flow.

## When the Plan Looks Wrong

> [accordion] A test is asserting on something that doesn't exist (e.g. a button labelled 'Submit' that's actually 'Save')
>
> The case is spec-based or pre-redesign. Refine it: "The button is labelled 'Save', not 'Submit'", and TestSprite rewrites it.

> [accordion] An obvious feature has zero test cases
>
> Exploration probably didn't reach it (check exploration on the <kbd>Sources</kbd> page). Re-run exploration with a clearer test account or extra context, or add cases via chat.

> [accordion] Tests are too generic and don't reflect our domain
>
> Add domain-specific extra context, e.g. "Our checkout has an 'Express' lane for returning customers; make sure tests cover it". Future runs incorporate it.

> [accordion] The plan ignored something I uploaded as a PRD
>
> The PRD shapes the plan but doesn't override exploration. If exploration didn't walk the feature your PRD describes, the case is spec-based and may lack specific selectors. Refine after generation.

## Where to Go Next

> [card] [Test Generation & Execution (UI)](https://docs.testsprite.com/web-portal/core/ui/ui-test-gen.md)
>
> Turn the plan into runnable Playwright code

> [card] [Step-by-Step Replay](https://docs.testsprite.com/web-portal/core/ui/ui-step-by-step.md)
>
> What you'll see during execution

> [card] [Managing Test Cases](https://docs.testsprite.com/web-portal/core/working-with-test/managing-test-cases.md)
>
> Natural-language adjustments after generation


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.