smoketest-writing

Automate end-to-end smoke test creation for FastAPI backends with Docker PostgreSQL and TestClient.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/databio/ai-sandbox --skill smoketest-writing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: smoketest-writing
Source: https://github.com/databio/ai-sandbox/tree/main/workspaces/.claude/skills/smoketest-writing
Command: npx skills add https://github.com/databio/ai-sandbox --skill smoketest-writing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates the creation of isolated integration/smoke tests for FastAPI backends using ephemeral Docker PostgreSQL, TestClient, and dependency injection to avoid touching dev databases.

Core Features & Use Cases

  • True isolation: tests run against a temporary PostgreSQL container rather than the development database.
  • Dependency injection: override get_session/get_dbagent to point to the test database.
  • Reusable patterns: scaffolds conftest fixtures, test runners, and example tests for common FastAPI projects.

Quick Start

Run the smoketest-writing guide to scaffold integration tests for a FastAPI project and execute them in an isolated environment.

Frequently Asked Questions about smoketest-writing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write isolated FastAPI smoketests without touching my development database?

Isolated FastAPI smoketests use ephemeral Docker PostgreSQL containers and FastAPI's TestClient to avoid touching the development database. The approach scaffolds conftest.py fixtures and test runners with dependency injection overrides to route database sessions to the temporary test database.

What is the best way to migrate real-server FastAPI tests to isolated TestClient-backed tests?

Migrating real-server FastAPI tests to isolated TestClient-backed tests involves scaffolding conftest.py fixtures, overriding get_session or get_dbagent dependencies, and executing tests against an ephemeral Docker PostgreSQL container with proper teardown within a structured workspace.

Does FastAPI TestClient work with Docker PostgreSQL for integration testing?

FastAPI TestClient works with Docker PostgreSQL for integration testing by spinning up an ephemeral PostgreSQL container, overriding dependency injection to point to the test database, and ensuring proper teardown after the test suite completes.

How do I set up pytest fixtures for FastAPI smoketests using a temporary database?

Setting up pytest fixtures for FastAPI smoketests requires creating a conftest.py file with dependency injection overrides for get_session, configuring an ephemeral Docker PostgreSQL instance, and defining a test runner script to manage the container lifecycle and teardown.

Can I use dependency injection to route FastAPI smoketests to a test database?

Dependency injection in FastAPI smoketests overrides functions like get_session or get_dbagent to route database queries to an ephemeral Docker PostgreSQL test database, ensuring true isolation from the development database during integration and smoke testing.

What do I need to scaffold integration tests for a FastAPI project with Docker PostgreSQL?

Scaffolding integration tests for a FastAPI project with Docker PostgreSQL requires creating a test-db.sh script, configuring conftest.py fixtures, setting up test runner scripts, and applying dependency injection overrides to ensure isolated TestClient-backed test execution.