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

# Agentic Test Generation

> Create end-to-end tests from natural language descriptions using Claude Code

Instead of recording a user flow in the browser, you can describe what you want to test in plain English and let Claude generate the test for you.

<Note>
  Before using this feature, set up the Claude Code integration first. See [Claude Code Integration](/pages/features/testing/claude-code-integration) for installation and authentication.
</Note>

## Creating a Test

In Claude Code, use the `/decipher-qa` slash command followed by a description of what you want to test:

```
/decipher-qa test the signup flow through email verification
```

Claude will:

1. **Explore your codebase** to understand your pages, components, and routes
2. **Generate test steps** based on your description
3. **Run the test** on a cloud-hosted browser
4. **Validate each step** and capture screenshots

You don't need to specify selectors, URLs, or step types — Claude figures those out from your code.

## Describing Your Test

Write your prompt like you'd explain the test to a teammate. Be specific about what the test should do, but you don't need to be technical.

**Good prompts:**

| Prompt                                                                      | What Claude generates                                                          |
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| `test the login flow with invalid credentials and verify the error message` | Navigate to login, enter bad credentials, submit, assert error message appears |
| `test creating a new project, editing its name, then deleting it`           | Full CRUD flow across multiple pages                                           |
| `test the billing settings page as an admin user`                           | Authenticated flow using a login identity                                      |
| `test that the search bar returns results for "shoes"`                      | Navigate to search, type query, assert results appear                          |

**Tips for better prompts:**

* Mention the specific page or feature (e.g., "the settings page", "the checkout flow")
* Include what you want to verify (e.g., "verify the success message appears")
* Mention the user role if the flow requires authentication (e.g., "as an admin user")

## Generating Multiple Tests

You can ask Claude to generate several tests at once:

```
/decipher-qa create tests for the full CRUD flow on the projects page:
- creating a new project
- editing a project name
- deleting a project
```

Claude will generate and validate each test independently.

You can also apply changes across existing tests in bulk from the Decipher dashboard using "Ask for Changes" — describe a modification in natural language and apply it to multiple tests at once.

## Automatic Self-Fixing

When a generated test fails during validation, Claude automatically diagnoses and fixes the issue:

1. Decipher's agent runs each step and flags any failures with diagnostics and screenshots
2. Claude analyzes the failure — wrong selector, missing wait, incorrect assertion, etc.
3. Claude fixes the failing steps
4. Validation resumes from where it left off, without re-running the entire test

This loop continues until the test passes or requires your input. If Claude can't resolve a failure, you'll see the failure details and screenshots so you can edit the step manually and resume.

## Modifying Tests with Natural Language

After a test is created, you can modify it without manually editing steps. Use "Ask for Changes" in the Decipher dashboard or ask Claude directly:

```
/decipher-qa add an assertion to verify the user is redirected to the dashboard after login
```

You can reference specific steps in your request:

```
/decipher-qa change step 3 to click the "Save" button instead of "Submit"
```

## When to Use Claude vs. Recording

| Scenario                                                        | Recommended approach                                             |
| --------------------------------------------------------------- | ---------------------------------------------------------------- |
| You know the flow but don't want to click through it            | **Claude** — describe it and let Claude generate the steps       |
| The flow involves complex interactions you'd rather demonstrate | **Recording** — click through it with the Chrome extension       |
| You want to generate tests for multiple flows quickly           | **Claude** — describe them all in one prompt                     |
| You need to test a page that isn't built yet                    | **Claude** — generate tests from your code before the UI is live |
| You want to capture exact timing and interactions               | **Recording** — the extension captures your real behavior        |
