mvp-ai's picture
download
raw
15.7 kB
id,category,option,best_for,avoid_when,tradeoffs,tags,last_verified
QA001,Testing Pyramid,Many Unit Tests + Fewer Integration Tests + Few E2E Tests,"The general shape to aim for on most projects — fast, cheap unit tests form the base; e2e tests cover only the critical user journeys","A thin CRUD app with almost no business logic to unit-test — there, integration tests covering the API layer directly may give more value per test written","Fast feedback loop (unit tests run in seconds) with e2e tests reserved for the few flows where only a real browser catches the bug (checkout, auth, payment) — inverting this pyramid (mostly e2e) makes CI slow and flaky",testing-pyramid|strategy|default,2026-07-03
QA002,Unit Testing,Test Business Logic in Isolation From Framework/DB,"Pure functions, service-layer logic, calculations, validation rules — anything that doesn't need a real database or HTTP request to exercise","Code that's mostly framework glue with no real logic of its own — testing that in isolation often just re-tests the framework, not your code","Fastest possible test feedback (milliseconds, no I/O), and forces business logic out of framework-coupled code into testable functions — a good side effect even beyond the tests themselves",unit-tests|isolation|business-logic,2026-07-03
QA003,Unit Testing,Vitest / Jest (Node.js/TypeScript),"Node.js/TypeScript projects — Vitest for Vite-based projects (faster, ESM-native), Jest for broader ecosystem compatibility and existing Jest-based codebases","A non-JS/TS backend (Python, etc.) — use the stack's native testing framework instead","Both are mature, fast, and support the same broad feature set (mocking, snapshots, coverage) — Vitest tends to be faster in Vite-based projects specifically due to shared config/transform pipeline",vitest|jest|nodejs|unit-testing,2026-07-03
QA004,Unit Testing,pytest (Python),"FastAPI/Django projects — pytest's fixture system and plugin ecosystem (pytest-asyncio, pytest-django) cover async and framework-specific testing needs well",Never really avoid pytest for Python testing — it's the de facto standard with the broadest ecosystem support,"Fixtures provide clean, composable test setup/teardown; the plugin ecosystem (pytest-cov, pytest-mock, pytest-asyncio) covers nearly every Python testing need without leaving the pytest ecosystem",pytest|python|unit-testing,2026-07-03
QA005,Component Testing,React Testing Library / Vue Testing Library,"Testing components the way a user actually interacts with them (by role, text, label) rather than implementation detail (internal state, class names)",Testing pure presentational logic with no user interaction to simulate — a plain unit test of the underlying function may be simpler,"Encourages accessible markup by design (queries are role/label-based, so an inaccessible component is also a hard-to-test one) and tests survive refactors that don't change user-visible behavior",testing-library|react|vue|component-testing,2026-07-03
QA006,Integration Testing,Test the API Layer Against a Real (Test) Database,Backend API testing — spin up a real test database (often via Docker or an in-memory/ephemeral instance) rather than mocking the DB layer entirely,Pure unit tests of business logic that don't touch the DB at all — mocking there is appropriate and faster,"Catches real query bugs, constraint violations, and ORM/query-builder mistakes that a mocked DB layer would never surface — meaningfully higher confidence than unit tests alone at the cost of slower test runs",integration-tests|database|api-testing,2026-07-03
QA007,Integration Testing,Supertest (Node.js HTTP assertion testing),"Express/Nest.js/Fastify APIs — issue real HTTP requests against the app in-process and assert on the response, without needing a running server",GraphQL-specific testing where a GraphQL client-testing library fits the query/mutation shape better,"Tests the actual HTTP layer (status codes, headers, response shape) rather than just the underlying function, catching integration bugs unit tests miss, while still running fast (in-process, no real network)",supertest|nodejs|http-testing,2026-07-03
QA008,Integration Testing,Test Containers for Ephemeral Test Databases,"CI pipelines needing a real, isolated Postgres/MySQL/Redis instance per test run rather than a shared or mocked database",Simple projects where an in-memory SQLite substitute is close enough to production behavior for the tests that matter,"Spins up a real, disposable instance of the actual database engine per test run (via Docker), giving high-fidelity integration tests without a shared, stateful test database that different CI runs could interfere with",testcontainers|docker|ci|database-testing,2026-07-03
QA009,E2E Testing,Playwright,"Cross-browser E2E testing of critical user journeys (signup, checkout, core workflows) — the current best-supported option for multi-browser (Chromium/Firefox/WebKit) automated testing","Testing every possible user flow exhaustively — e2e tests are the most expensive to write and maintain, reserve them for genuinely critical paths (QA001)","Fast, reliable auto-waiting (reduces flakiness vs manual waits), built-in trace/video capture for debugging failures, and genuine multi-browser support in one API",playwright|e2e|cross-browser,2026-07-03
QA010,E2E Testing,Cypress,"Teams already invested in Cypress's ecosystem, or wanting its component-testing mode alongside e2e in one tool",New projects with no existing Cypress investment — Playwright's multi-browser support and auto-waiting are generally the stronger default choice for a fresh project today,"Strong developer experience (time-travel debugging, live reload) and a mature plugin ecosystem, though multi-browser (especially WebKit/Safari) support has historically lagged Playwright's",cypress|e2e|component-testing,2026-07-03
QA011,E2E Testing,"Only Cover Critical User Journeys, Not Every Page","Every project — signup, login, checkout/payment, and the core value-delivering action of the product get e2e coverage; a static About page does not","A regulated context requiring documented test coverage of every user-facing flow regardless of criticality — rare, and worth flagging as an explicit exception when it applies",E2E tests are the slowest and most maintenance-prone tier of the pyramid (QA001) — spending that budget on the flows that actually matter (where a bug means lost revenue or a broken core loop) maximizes ROI per test written,e2e|test-scope|prioritization,2026-07-03
QA012,Mocking Strategy,"Mock External Third-Party Services, Not Your Own Code","Tests that would otherwise call a real third-party API (Stripe, an email provider, an external data source) — mock the boundary, not your own business logic","Mocking your own database/service layer so thoroughly that the test only verifies the mock was called correctly, not that the real code path works — that's a false-confidence test","Keeps tests fast and deterministic (no flaky network calls to a real third party) while still exercising your actual code, not a mocked version of it — the boundary to mock is the edge of your system, not the middle of it",mocking|third-party|test-doubles,2026-07-03
QA013,Test Data,"Factories/Builders for Test Data, Not Hand-Copied Fixtures","Any test needing realistic entity data — a factory function generating a valid `User`/`Order`/etc. with sensible defaults, overridable per test","A single, genuinely one-off test needing very specific hardcoded values with no reuse value — a literal object may be clearer there than a factory call","Reduces duplication and makes tests resilient to schema changes (add a new required field once in the factory, not in every test file that constructs that entity) — hand-copied fixture objects break in bulk on any schema change",test-factories|fixtures|test-data,2026-07-03
QA014,Snapshot Testing,"Use Sparingly, for Genuinely Stable Output","Output that's expected to be stable and where a diff genuinely signals something worth reviewing (e.g. a generated API schema, a stable serialization format)",UI component snapshots that change on every minor style tweak — these become 'update snapshot and move on' rituals that catch nothing real; prefer explicit assertions on specific rendered content instead,"Catches unintended changes to genuinely stable output cheaply, but overused on frequently-changing UI it degrades into a rubber-stamp step nobody actually reviews carefully",snapshot-testing|anti-pattern-risk,2026-07-03
QA015,API Contract Testing,Contract Tests Between Frontend and Backend (or Between Services),"Microservices or a frontend/backend split with independent deploy cycles, where a backend change could silently break a frontend expecting the old contract",A tightly coupled monorepo full-stack app (e.g. Next.js) where frontend and backend always deploy together — the contract can't drift since both change atomically,"Catches a breaking API change before it reaches production by verifying both sides against a shared contract definition, valuable specifically when frontend/backend (or two services) can deploy independently of each other",contract-testing|microservices|api-compatibility,2026-07-03
QA016,Load/Performance Testing,"Load Test Before a Known Traffic Spike, Not as a Default Habit","A launch, a marketing campaign, or a known seasonal traffic event where you want confidence the system holds up before it happens for real",Continuous/routine load testing on every PR for a low-traffic internal tool — the setup and run cost isn't justified there,"Surfaces capacity/scaling problems (connection pool exhaustion, missing indexes under concurrent load, rate-limit misconfiguration) before real users do, targeted at the specific events where the cost of finding out live would be highest",load-testing|performance|launch-readiness,2026-07-03
QA017,Flaky Tests,"Fix or Delete Flaky Tests Immediately, Never Let Them Linger","Any test failing intermittently for reasons unrelated to a real bug (timing, shared state, unmocked network) — fix the root cause or remove the test the same week it's identified as flaky",Never let a flaky test 'just be flaky' long-term — retry-until-pass CI configurations that paper over flakiness quietly erode the entire test suite's signal value,A test suite where failures are ignored ('oh that one's just flaky') has effectively stopped being a safety net — every flaky test left unaddressed trains the team to ignore future real failures too,flaky-tests|test-hygiene|ci-signal,2026-07-03
QA018,Coverage,"Track Coverage as a Signal, Not a Target to Game",Using coverage reports to find genuinely untested critical code paths — that's valuable. Setting a hard numeric threshold (e.g. '90% or the build fails') without judgment about what's actually being tested,A coverage threshold enforced so rigidly that developers write low-value tests (asserting nothing meaningful) purely to hit the number — that's the target being gamed instead of guiding real test quality,"Coverage percentage tells you what code ran during tests, not whether it was tested meaningfully — use it to find gaps in critical logic, not as a proxy for test quality on its own",code-coverage|metrics|anti-pattern-risk,2026-07-03
QA019,CI Test Execution,Run Tests in Parallel Across CI Workers,Test suites large enough that serial execution meaningfully slows the PR feedback loop — split by file or by test-runner's built-in sharding,Small test suites (under a minute or two serially) where parallelization setup overhead isn't worth it yet,"Cuts wall-clock CI time significantly for large suites, at the cost of needing test isolation discipline (tests can't share mutable state) since they may run concurrently on different workers",ci|parallelization|test-performance,2026-07-03
QA020,Test Isolation,Every Test Independent — No Shared Mutable State or Ordering Dependency,"Every test suite, without exception — a test should pass or fail the same way regardless of what ran before it or in what order","Never applicable to skip — order-dependent tests are one of the most common sources of 'passes locally, fails in CI' (or the reverse) confusion","A test suite where tests must run in a specific order, or share mutable global/database state, becomes fragile in exactly the ways parallelization (QA019) and re-running individual failing tests both need to not be fragile",test-isolation|test-independence|reliability,2026-07-03
QA021,Framework-Specific,Next.js — Test Route Handlers and Server Components Separately From Client Components,Next.js App Router apps: unit/integration test Route Handlers and server-side logic directly (no browser needed); use React Testing Library for client components; reserve Playwright for full-page e2e flows crossing both,Treating every Next.js test as requiring a full browser — most server-side logic can be tested faster and more reliably without one,"Matches each layer to its fastest appropriate test tool rather than defaulting everything to slow, heavier e2e tests just because it's a full-stack framework",nextjs|testing-strategy|app-router,2026-07-03
QA022,Framework-Specific,FastAPI — TestClient for In-Process API Testing,"FastAPI apps: use FastAPI's `TestClient` (built on httpx) to issue requests against the app in-process, without a running server, for both unit-adjacent and integration-style tests","End-to-end browser flows against a full deployed environment — TestClient covers the API layer, not a rendered frontend","Fast, in-process API testing with the same dependency-injection and validation behavior as production, without the overhead of a real running server per test",fastapi|testclient|api-testing,2026-07-03
QA023,Framework-Specific,Django — pytest-django Plus Database Transaction Rollback per Test,"Django/DRF apps: pytest-django wraps each test in a database transaction that rolls back afterward, giving test isolation (QA020) without manually cleaning up data",A test genuinely needing to verify commit/rollback behavior itself — that specific test may need a different isolation strategy,"Each test gets a clean database state automatically without manual teardown code, while still testing against real Django ORM behavior rather than a mock",django|pytest-django|test-isolation,2026-07-03
QA024,Framework-Specific,Supabase — Test Against a Local Supabase Instance or a Dedicated Test Project,"Supabase-backed apps: run `supabase start` locally (or use a dedicated Supabase test project/branch) for integration tests exercising real Postgres + RLS policies, not a database mock",Pure unit tests of business logic with no DB/RLS interaction to verify — mock or skip the DB layer entirely there,RLS policies are part of your authorization logic (see auth-patterns.md) and can't be meaningfully verified against a mock — testing against a real Postgres instance (local or a branch) is the only way to actually confirm a policy behaves as intended,supabase|rls|integration-testing,2026-07-03
QA025,Test-Driven Development,"Write the Test First for Bug Fixes, Optional Elsewhere","Fixing a reported bug — write a failing test that reproduces it first, then fix the code until it passes, guaranteeing the bug can't silently regress",Exploratory prototyping where the shape of the solution is still unclear — writing tests against code that will be thrown away or heavily reworked wastes the TDD benefit,"Guarantees every fixed bug gets permanent regression coverage as a side effect of the fix process itself, without requiring full TDD discipline for all new feature development",tdd|bug-fixes|regression-testing,2026-07-03

Xet Storage Details

Size:
15.7 kB
·
Xet hash:
edbdd0353eb22d1b27e6aab0648db785e4f339713f7d5997416f939ca66ec5c9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.