Setting up TestDriver CLI
Follow these steps to install and set up TestDriver CLI.
Install Node.js
Ensure you have Node.js (v16 or higher) installed.
Check your Node.js version:
If not installed, download it from Node.js Official Website.
Install NPM
npm: Comes with Node.js. Verify npm
is installed:
Install TestDriver
Install the TestDriver CLI globally using npm:
Verify the installation:
Set Up Your Test Runner
TestDriver requires a runner to execute tests. You can use either a hosted sandbox or your own computer.
- TestDriver Sandbox - Run tests in a ephemeral linux virtual machine. Recommended for ease of use, added privacy, and parallelization. Requires a TestDriver API key.
- Local Runner - Run tests on your own computer. Recommended for working with existing user sessions, files, and applications. Requires additional setup.
Run testdriverai init
in your project directory and choose “yes” for the sandbox option. This will prompt you for your API key.
This will write the TD_VM
and TD_API_KEY
values to .env
file in your project directory.
Run testdriverai init
in your project directory and choose “yes” for the sandbox option. This will prompt you for your API key.
This will write the TD_VM
and TD_API_KEY
values to .env
file in your project directory.
Install Python & Visual Studio build tools
Install Node.js
You will also need Node.js if you don’t have it yet.
Set execution policy
Open a new terminal with admin privileges and execute the following command :
This gives TestDriver the right to execute it’s scripts and is only valid for the current user.
Enable screen recording permissions
TestDriver requires screen recording permissions to capture your screen during test execution.
- Open System Preferences > Security & Privacy > Privacy > Screen Recording.
- Check the box next to your terminal application (for example, Terminal, iTerm2) to allow screen recording.
This is required for TestDriver to capture your screen during test execution.
Enable accessibility permissions
- Open System Preferences > Security & Privacy > Privacy > Accessibility.
- Check the box next to your terminal application (for example, Terminal, iTerm2) to allow accessibility features.
This is required for TestDriver to interact with your applications during test execution.
Run TestDriver in Interactive Mode
Start TestDriver in interactive mode.
You should see a prompt like this: