You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update end-to-end testing docs for test generation
Clarifies instructions for generating test files, including improved guidance on expanding generated tests, updated dependency installation, and clearer provider/model selection examples. Reorders and revises credential setup steps for better readability.
Copy file name to clipboardExpand all lines: docs/end-to-end-testing.qmd
+12-14Lines changed: 12 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -174,35 +174,33 @@ shiny add test
174
174
```
175
175
176
176
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_`.
177
-
1.The generated test file typically provides basic assertions that verify visible text and interactive state changes for Shiny components (e.g., slider values, output text).
177
+
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.
178
178
179
179
Before generating tests, make sure you have:
180
180
181
+
- An API key or credentials for the provider you intend to use:
182
+
- Anthropic: `export ANTHROPIC_API_KEY=...`
183
+
- OpenAI: `export OPENAI_API_KEY=...`
184
+
181
185
- A working Shiny app file (e.g. `app.py`).
182
186
- Shiny testing dependencies installed. If you haven't installed the extras yet:
183
187
184
188
```bash
185
-
pip install "shiny[test,testgen]"
189
+
pip install "shiny[add-test]"
186
190
```
187
191
188
-
- An API key or credentials for the provider you intend to use:
189
-
- Anthropic: `export ANTHROPIC_API_KEY=...`
190
-
- OpenAI: `export OPENAI_API_KEY=...`
191
-
192
-
193
192
#### Choosing a provider for generating tests
194
193
195
194
```bash
196
195
# Anthropic (default)
197
-
shiny add test --app app.py --provider anthropic --model sonnet
196
+
shiny add test --app app.py
198
197
199
-
# OpenAI
200
-
shiny add test --app app.py --provider openai --model gpt-5
201
-
```
198
+
# OpenAI (will use gpt-5)
199
+
shiny add test --app app.py --provider openai
202
200
203
-
::: callout-note
204
-
The generated file is a **starting point**, not a full coverage suite. Iterate toward meaningful, stable assertions aligned with your app’s business logic.
205
-
:::
201
+
# explicitly use gpt-5-mini model
202
+
shiny add test --app app.py --provider openai --model gpt-5-mini
0 commit comments