Sample repo that has a guide for common web use cases. Using a Desktop app and need help? Email us at [email protected] and we can help if you get stuck.
What is TestDriver?
Next generation autonomous AI agent for end-to-end testing of web & desktop
Website | Docs | Join our Forum | Signup
First, fork this repository.
TestDriver requires an API key. Get one by signing up at app.testdriver.ai and start your 7-day trial.
Tests are defined in YAML files located in the testdriver/tests
directory. Each test file contains a series of steps that the AI agent will execute.
1. Interactive Mode (see mytest.yaml
)
- Run
npx testdriverai@latest testdriver/tests/mytest.yaml
and enter prompts interactively - TestDriver will generate specific commands for each prompt and save them to the file
- For more info see Interactive Mode Documentation
2. Prompt-Based Testing (see prompts.yaml
)
- Write your test plan/steps/exit criteria as a set of prompts in a YAML file
- TestDriver executes them in order, creating commands on the fly
- Use
--heal
and--write
flags to save working steps and enable auto-retry - TestDriver can also generate prompts using the
/generate
command - see Generation Documentation
Use the --heal
flag to enable automatic retry of failed steps. Documentation: Auto-Healing
Note: The website will be loaded automatically before the first step (configured in prerun.yaml
), so you don't need to include navigation commands.
TestDriver uses three types of lifecycle scripts that run at different stages of the testing process:
- Run BEFORE each test in the suite
- Used for setting up the testing environment
- Example: Launching Chrome with specific configurations, setting up TestDriver Dashcam for replays and logs
- Run ONCE when your VM is created
- Used for initial setup that only needs to happen once per VM
- Example: Downloading files from Google Drive or GitHub repositories to add to the VM during provisioning
- Run AFTER each test in the suite
- Used for cleanup or post-processing tasks
- Example: Sending dashcam recordings to the server
The .env.example
file shows the required environment variables:
TD_API_KEY
: Your TestDriver API keyTD_WEBSITE
: The website to testTD_TEST_USERNAME
andTD_TEST_PASSWORD
: Optional - Credentials for testing
Rename .env.example
to .env
and fill in your actual values.
To run a test, use the following command from your favorite terminal:
npx testdriverai@latest run tests/test_case.yaml
To use an integrated IDE experience for creating, viewing, debugging and running tests, we recommend VS Code with the TestDriver.ai extension.
The repository includes a GitHub Actions workflow (testdriver.yml
) that allows you to run tests manually or automatically. You can select a specific test folder or file to run through the GitHub Actions interface.
Using a different CI/CD tool? No problem! The testdriver.yml
file can be used as a template for other CI/CD tools. Just run the npx testdriverai@latest run
command with the path to your test file in your CI/CD pipeline.