TestDriver provisions a fresh cloud VM for every test by default. This guide covers how to configure Linux and Windows machines, reduce startup time by keeping machines alive between runs, use provision scripts for repeatable setup, and install custom software on the fly.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.
Linux Machines
Linux is the default operating system. No extra configuration is required.Common Linux Options
| Option | Type | Default | Description |
|---|---|---|---|
os | string | "linux" | Operating system |
resolution | string | "1366x768" | Screen resolution (Enterprise only) |
e2bTemplateId | string | — | Custom E2B template ID (see Self-Hosted) |
keepAlive | number | 60000 | Ms to keep VM alive after disconnect |
reconnect | boolean | false | Reconnect to last used sandbox |
Windows Machines
Setos: "windows" to provision a Windows VM instead. Everything else works the same way.
Common Windows Options
| Option | Type | Default | Description |
|---|---|---|---|
os | string | — | Set to "windows" |
resolution | string | "1366x768" | Screen resolution (Enterprise only) |
sandboxAmi | string | — | Custom AMI ID (self-hosted) |
sandboxInstance | string | — | EC2 instance type (self-hosted) |
keepAlive | number | 60000 | Ms to keep VM alive after disconnect |
reconnect | boolean | false | Reconnect to last used sandbox |
Keeping Machines Alive Between Runs
Windows (and Linux) cold starts can be expensive if you’re iterating quickly. UsekeepAlive + reconnect to reuse the same VM across multiple test runs.
Step 1 — Start the machine with a long keepAlive
Step 2 — Connect in subsequent runs
- You reuse a specific running machine directly
- You can continue from the app state created in an earlier test run
- You should run within the previous test’s
keepAlivewindow
How keepAlive works
keepAlive is a duration in milliseconds. After the SDK disconnects, the server keeps the VM running for that long before terminating it. The default is 60000 (1 minute). Note: keepAlive: 0 currently falls back to the default disconnect grace period rather than terminating immediately, so use a positive duration when you want to control the grace window explicitly.
Using Provision Scripts
Provision scripts let you run arbitrary setup steps before your test starts — downloading fixtures, seeding a database, configuring environment variables, and more. Usetestdriver.exec() to run shell or PowerShell commands directly in the sandbox.
exec() Reference
Full reference for running shell and PowerShell commands in the sandbox.
Linux setup script
Windows setup script (PowerShell)
Clone a repo and run a script
Installing Custom Software
You can install software at the start of a test usingexec(). This works for any package available via apt, brew, choco, winget, npm, pip, or direct download.
Linux — apt packages
Linux — Node.js tools
Windows — winget
Windows — Chocolatey
Download and run an installer
Installing software at test start adds to your test duration. For software you use in every test, consider preloading it into a custom VM image via the Enterprise self-hosted plan.
Want Software Pre-Installed on Every Machine?
Installing packages at runtime works well for occasional or lightweight dependencies. But if you’re installing the same 5-minute setup on every test run, you’re wasting time and credits. With the Self-Hosted Enterprise plan you get access to our golden VM base image and Packer scripts, so you can bake your applications, dependencies, and configuration directly into a custom AMI. Tests spin up with everything already installed — zero setup time.Self-Hosted Enterprise
Preload software, configure custom hardware, and run unlimited tests with a flat license fee. Our team assists with deployment and setup.

