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

# Generating Tests

> Use AI coding agents and exploration mode to generate TestDriver tests

## Instructions for Coding Agents

We recommend starting with [our quickstart](./quickstart) then supplying your coding agent with our agent instructions file.

<Card title="TestDriver Agent Instructions" icon="link" arrow="true" horizontal href="https://github.com/testdriverai/testdriverai/blob/main/ai/agents/testdriver.md?plain=1">
  Copy the current version of our agent instructions to provide your coding agent with up-to-date instructions on how to generate TestDriver tests.
</Card>

Then, you can prompt your coding agent to generate tests. Here is an example prompt:

```md theme={null}
Make me a TestDriver test that does the following steps:

Navigate to practicetestautomation.com
Type username student into Username field
Type password Password123 into Password field
Push Submit button
Verify new page contains expected text 'logged in'
```

## AI Exploration Mode

Within a test, the `ai()` method lets TestDriver autonomously figure out how to accomplish a task. It's useful for dynamic or unpredictable UIs where explicit actions may be difficult to define.

```javascript theme={null}
// Handle dynamic or unpredictable UI
await testdriver.ai('dismiss any popups or modals that appear');
```

<Info>Explicit commands are preferred for production tests, as they are cheaper, faster, and more reliable.</Info>
