Testing¶
Testing in this cookbook has two goals:
- Validate repository quality checks.
- Validate that each runnable example behaves as documented.
Repository-level checks¶
Run the full quality suite:
This includes:
- Linting and type checks
- Unit tests
- Security scan
For docs integrity:
Individual commands¶
| Command | What it validates |
|---|---|
make format |
Formatting conventions |
make lint |
Ruff + mypy correctness |
make test |
Automated tests |
make cov |
Coverage report generation |
make security |
Bandit static security checks |
make docs |
MkDocs build and link rendering |
Testing recipe examples locally¶
HTTP API Basic¶
Smoke checks:
curl http://localhost:7071/api/items
curl http://localhost:7071/api/items/1
curl -X POST http://localhost:7071/api/items -H "Content-Type: application/json" -d '{"name":"Paper","category":"office"}'
curl -X DELETE http://localhost:7071/api/items/1
HTTP API with OpenAPI¶
Smoke checks:
Manual UI check: http://localhost:7071/api/docs.
GitHub Webhook¶
Set GITHUB_WEBHOOK_SECRET, then send signed and unsigned test payloads.
Expected behavior: unsigned or invalid signatures return 401.
Queue Worker¶
Run Azurite and enqueue JSON messages into work-items.
Verify logs show dequeue count, JSON parsing, and task completion.
Timer Job¶
Verify scheduled runs in logs, then manually trigger with:
curl -X POST http://localhost:7071/admin/functions/scheduled_job -H "Content-Type: application/json" -d '{"input":"test"}'
What to test when editing docs¶
When documentation changes include command examples or paths:
- Confirm every path exists
- Confirm commands are still valid for current repo layout
- Confirm route names match real handlers in
examples/*/function_app.py - Confirm recipe page cross-links resolve
CI alignment¶
Local validation should mirror CI as closely as possible. Before PR submission, run at minimum:
If your change touches trigger behavior, also run the relevant example app and manually verify expected responses or logs.
See also: Development, Troubleshooting