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

# Editing

> Edit previously generated tests.

Test scripts are written in YAML format, making them easy to read and modify manually if you need to.

<Card title="Commands Reference" icon="link" href="/commands/assert">
  Explore the available commands and their parameters.
</Card>

## Locate the Test File

TestDriver test files are typically stored in the `testdriver/` directory of your project. The default file is `testdriver/testdriver.yaml`.

### Open the Test File

Use your preferred text editor or IDE (for example, Visual Studio Code) to open the YAML file.

### YAML Structure

Each test file consists of:

* **Version**: Specifies the TestDriver version that was used to generate the test file. This is used to lock the version of TestDriver that is used to run the test.
* **Session**: A unique identifier for the test session.
* **Steps**: A list of prompts and commands to execute.

```yaml test-file.yaml theme={null}
version: 6.0.0
session: abc1234
steps:
  - prompt: Open Google Chrome and navigate to Airbnb
    commands:
      - command: focus-application
        name: Google Chrome
      - command: hover-text
        text: Search Google or type a URL
        description: main google search
        action: click
      - command: type
        text: airbnb.com
      - command: press-keys
        keys:
          - enter
```

<Tip>
  The `version` captured when you generate a test file is the version of
  TestDriver you used, and isn't used when running the test. This doesn't affect
  your ability to use newer versions of TestDriver on existing test files nor do
  these need to be updated when migrating to a new version.
</Tip>

### Modify the test steps

You can add, edit, or remove steps as needed. Each step contains:

* **Prompt**: A description of the action.
* **Commands**: The specific actions to perform. It is an **optional** field, meaning, if there are no `commands` the AI considers the `prompt` and generates and executes the yaml on-the-go using the [exploratory mode](/interactive/explore)

#### Example edits:

* **Add a Wait Command**:

  ```yaml theme={null}
  - command: wait
    timeout: 3000
  ```

* **Change the URL**:
  Update the `text` field in the [`type`](/commands/type) command:

  ```yaml theme={null}
  - command: type
    text: booking.com
  ```

### Validate the YAML syntax

Ensure the YAML file is properly formatted:

* Use consistent indentation (2 spaces recommended).
* Avoid trailing spaces or tabs.
* TestDriver will validate the yaml syntax and provide suggestions to fix any errors when you run the test.

<Tip>
  It is recommended to use our [VS Code extension](/getting-started/vscode)
  while you are editing the yaml. It will provide you with a rich experience
  with auto-completion, syntax highlighting, and validation.
</Tip>

### Test the changes

Run the updated test to verify it works as expected:

```bash theme={null}
npx testdriverai@latest run path/to/test.yaml
```
