---
title: Testing with tmux
description: Test Kit's TUI non-interactively using tmux.
---

# Testing with tmux

Kit's interactive TUI can be tested non-interactively using tmux. This is useful for automated testing, CI pipelines, and extension development.

## Basic pattern

```bash
# Start Kit in a detached tmux session
tmux new-session -d -s kittest -x 120 -y 40 \
  "output/kit -e ext.go --no-session 2>kit_stderr.log"

# Wait for startup
sleep 3

# Capture the current screen
tmux capture-pane -t kittest -p

# Send input
tmux send-keys -t kittest '/command' Enter

# Wait for response
sleep 2

# Capture updated screen
tmux capture-pane -t kittest -p

# Cleanup
tmux kill-session -t kittest
```

## Testing extensions

When testing extensions, the pattern is:

1. Build Kit with your changes
2. Start Kit in tmux with the extension loaded
3. Send slash commands or prompts
4. Capture and verify the screen output
5. Check stderr logs for errors

```bash
# Build first
go build -o output/kit ./cmd/kit

# Start with extension
tmux new-session -d -s kittest -x 120 -y 40 \
  "output/kit -e examples/extensions/widget-status.go --no-session 2>kit_stderr.log"

sleep 3

# Verify widget appears in screen
tmux capture-pane -t kittest -p | grep "Status"

# Send a slash command
tmux send-keys -t kittest '/stats' Enter
sleep 1
tmux capture-pane -t kittest -p

# Cleanup
tmux kill-session -t kittest
```

## Tips

- Use `-x` and `-y` to set consistent terminal dimensions
- Redirect stderr to a log file (`2>kit.log`) for debugging
- Use `--no-session` to avoid creating session files during tests
- Add sufficient `sleep` between commands for the TUI to render
- Use `grep` on captured pane output to verify specific content
