Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
27 changes: 26 additions & 1 deletion docs/end-to-end-testing.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,33 @@ shiny add test
```

1. Answer the prompts: It will ask for the path to your app file (e.g., `app.py`) and a name for your test file (e.g., `test_myapp.py`). Remember, the test file name must start with `test_`.
1. Generated test files usually include simple assertions that check visible UI text and interactive states for Shiny components (for example, slider values or checkbox output). Treat these as a starting point and expand them to cover additional behaviors, edge cases, and integration points as needed.

1. Edit the generated test file: This command creates a basic test file. You'll need to modify it to add your specific test scenarios (like the slider example above).
Before generating tests, make sure you have:

- An API key or credentials for the provider you intend to use:
- Anthropic: `export ANTHROPIC_API_KEY=...`
- OpenAI: `export OPENAI_API_KEY=...`

- A working Shiny app file (e.g. `app.py`).
- Shiny testing dependencies installed. If you haven't installed the extras yet:

```bash
pip install "shiny[add-test]"
```

#### Choosing a provider for generating tests

```bash
# Anthropic (default)
shiny add test --app app.py

# OpenAI (will use gpt-5)
shiny add test --app app.py --provider openai

# explicitly use gpt-5-mini model
shiny add test --app app.py --provider openai --model gpt-5-mini
```

### Troubleshooting Common Issues

Expand Down
Loading