- Launches a fresh instance from the TestDriver AMI.
- Installs and starts the runner on it over AWS Systems Manager (SSM).
- Runs the test, then terminates the instance.
Self-hosting is part of the Enterprise plan. See Self-hosted.
Before you begin
- Access to the TestDriver AMI. TestDriver shares it with your AWS account. Contact TestDriver with your account ID and region to get the AMI ID.
- The AWS CLI, installed and signed in, on every machine that runs tests (your laptop and your CI runners).
jq, which the instance launch script uses to read AWS responses.- A TestDriver project with your API key in
TD_API_KEY. See Set up a project.
Step 1: Deploy the CloudFormation stack
The template creates:- A VPC with a public subnet and internet gateway.
- A security group that allows RDP, VNC, and web traffic from the IP range you choose.
- An IAM role and instance profile with SSM access.
- An EC2 launch template, and optionally a key pair.
- AWS console
- AWS CLI
Launch the stack
Open the template in the CloudFormation console.
LaunchTemplateId.Stack parameters
Step 2: Add the AWS setup file to Vitest
Addtestdriverai/vitest/setup-aws to setupFiles. It launches an instance before each test that runs on Windows.
vitest.config.mjs
hookTimeout gives a new instance time to boot, pass its status checks, and register with SSM.
Step 3: Write your test
Your tests don’t change. The setup file passes the instance’s IP address and ID toTestDriver() for you:
tests/login.test.mjs
Step 4: Run the tests
SetTD_OS=windows to turn on the setup file, along with your launch template and AMI:
TD_OS isn’t windows, the setup file does nothing and tests run on TestDriver’s cloud.
Environment variables
The AWS CLI reads your credentials from its usual sources, such as
aws configure, AWS_PROFILE, or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
AWS permissions
The credentials that run your tests need these actions:ec2:RunInstances,ec2:CreateTags,ec2:DescribeInstances,ec2:DescribeInstanceStatus, andec2:TerminateInstancesiam:PassRolefor the stack’s instance rolessm:DescribeInstanceInformation,ssm:SendCommand, andssm:GetCommandInvocation
Run in GitHub Actions
This workflow authenticates to TestDriver with the TestDriver action and to AWS with stored access keys:.github/workflows/testdriver-windows.yml
ubuntu-latest runners already include the AWS CLI and jq.
Connect to an instance
To watch or debug a test, connect to its instance over RDP on port 3389 while it runs. The setup file prints the instance’s IP address when it launches it. The TestDriver AMI signs in as the usertestdriver. Ask TestDriver for the default password, and change it before you build your own image.
Create a custom AMI
Preinstall your apps and test data so tests don’t spend time on setup.1
Launch an instance and connect
Launch an instance from the TestDriver AMI with the stack’s launch template:When it’s running, connect to its public IP address over RDP.
2
Rotate the default password
Run the password rotation script and save the new password:
3
Install your software
Install your apps, dependencies, certificates, and data.
4
Create the AMI
Create an image from the instance:Set
AMI_ID to the new image’s ID when you run tests.Troubleshooting
TD_OS=windows requires AWS_LAUNCH_TEMPLATE_ID and AMI_ID
TD_OS=windows requires AWS_LAUNCH_TEMPLATE_ID and AMI_ID
Set both variables in the environment that runs
npx vitest run. In CI, check that the secrets are passed to the test step.AWS CLI is not installed
AWS CLI is not installed
Install the AWS CLI on the machine that runs the tests, and check that
aws is on the PATH.SSM registration timeout
SSM registration timeout
The instance didn’t register with Systems Manager. Check that:
- The launch template from the stack is used, so the instance gets the stack’s IAM role.
- The instance is in the stack’s public subnet, so it can reach SSM.
- The AMI is the TestDriver AMI, or an image built from it.
A test fails before it starts with a hook timeout
A test fails before it starts with a hook timeout
Launching and preparing an instance takes several minutes. Raise
hookTimeout in vitest.config.mjs.Instances are left running
Instances are left running
TestDriver terminates instances after each test and when the process exits. A killed CI job can still leave one behind. Find instances by their
Name tag, which starts with td-, and terminate them:Next steps
Run on your own machine
Run the runner on a laptop, lab machine, or on-prem VM.
Run tests in CI/CD
Authenticate and run tests in any CI provider.
Self-hosted
What the Enterprise plan includes.
Launch apps
Start Chrome, desktop apps, and installers in the sandbox.

