> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# bach test

> bach test installs your setup file in Windows Sandbox, starts the app, removes it and reports failures and leftovers. Or run it on CI with --here.

`bach test` tries your setup file the way a user would: it installs it silently, starts the app, removes it and reports what failed and what was left behind. By default it does this in Windows Sandbox, a temporary copy of Windows, so your computer isn't changed.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build
bach test
```

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Testing Hello 1.4.0 in Windows Sandbox
  ok    Installed      exit code 0 in 0.7 s
  ok    Registered     Settings > Apps lists Hello 1.4.0
  ok    Files          12 of 12 files are in …\Programs\Hello
  ok    Uninstaller    uninstall.exe is in the install folder
  ok    Started        still running after 5 s
  ok    Removed        exit code 0 in 0.7 s
  ok    Left behind    nothing
```

| Argument or flag | Default | Meaning |
| - | - | - |
| `FILE` | the one `bach.toml` builds | The setup file |
| `--config FILE` | `bach.toml` | Used to find the setup file |
| `--with IDS`, `--without IDS` | | Options to install with |
| `--launch SECONDS` | 5 | How long the app runs; `0` skips starting it |
| `--network` | off | Give the sandbox network access (needed for online installers) |
| `--timeout MINUTES` | 20 | How long to wait |
| `--keep` | off | Leave the sandbox open afterwards |
| `--dry-run` | off | Only write the test files |
| `--here` | off | Test on this computer instead (not with `--keep`) |

Exit code 0 means every check passed. `--json` gives `passed`, `steps` and `left_behind`.

## Requirements

Windows Sandbox is part of Windows 10 and 11 Pro, Enterprise and Education, not Home. Turn it on under "Turn Windows features on or off". An installer that needs administrator rights shows the prompt inside the sandbox. Apps with an access key can't be tested, because a silent install can't type a key.

## Without a sandbox

`--here` runs the same test on the computer itself. It really installs and removes the app, so only use it on CI or a virtual machine. It refuses to run if the app is already installed.

```yaml theme={"theme":{"light":"github-light","dark":"github-dark"}}
- run: bach build
- run: bach test --here
```

GitHub's Windows runners can run `--here`, including machine-wide installers, since the job already has administrator rights.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.