# Testing
## Automated tests
`cargo test` runs two kinds of tests, and CI runs them on Windows, macOS and Ubuntu:
- Unit tests, next to the code they test. They use made-up input: fake process trees
(`procs::fake::FakeTable`) and invented environment variables, folders and ids.
- [tests/conventions.rs](../tests/conventions.rs), which checks the repository against the
rules in [CONVENTIONS.md](../CONVENTIONS.md) that a program can check.
## End-to-end tests
Each terminal has a manual checklist below. Run it once kaeru supports that terminal; the
[roadmap](../README.md#roadmap) says which ones it does.
Every checklist follows the same idea: open some tabs, close the whole terminal, open it again,
and check that the right tabs come back.
### Use a second copy of the terminal
Test in a separate copy of the terminal, so that you can close it completely without closing
the one you work in.
- Windows Terminal: download the portable zip (`Microsoft.WindowsTerminal_<version>_x64.zip`)
from the [releases page](https://github.com/microsoft/terminal/releases), check that
`WindowsTerminal.exe` is signed by Microsoft, and put an empty file named `.portable` next to
it, so that it keeps its own settings. In its settings, set
`"warning.confirmCloseAllTabs": false`, so that it closes without asking.
### Windows Terminal
1. Run `kaeru install`. Start Codex once, trust the kaeru hook when it asks, and quit it. Open a
new tab in the test terminal: `kaeru doctor` reports no problems there.
2. In the test terminal, open four tabs:
- A: a shell in some folder;
- B: Claude Code in another folder, with one message sent;
- C: Codex in a third folder, with one message sent;
- D: a plain shell.
3. Close tab D, then open a new tab. `kaeru list` no longer shows D.
4. Close the whole test terminal window.
5. Open the test terminal again. The picker lists A, B and C, but not D.
6. Press Enter: the cursor starts on Done, so the checked tabs come back, one about every
second, in the order they were first opened, while the picker's tab shows `Reopening 1 of 3`
and so on. Then the picker's tab closes, so that the test terminal has three tabs. A comes
back in its folder, B comes back with `claude --resume`, and C comes back with
`codex resume`, all in the test terminal and not in your main one.
7. Run a command that fails, such as `Get-Item nothing-here`, in a tab with a prompt theme that
shows failures, such as oh-my-posh or starship. The prompt shows the failure.
8. Close the test terminal. The next time you're asked, press `a` to uncheck every tab, check
that Done says `forget`, and press Enter, to forget the test tabs.
Run the checklist twice for Codex: once with the `codex-no-daemon` option on, which you turn on
in `kaeru install`, and once with `codex-no-daemon = false` in kaeru's `config.toml`. In the
first run, C runs in its tab; in the second, Codex's shared background server runs it.