Skip to main content

Testing

Testing strategies and quality assurance best practices

16
Best Practices
3
FAQs
1
Generators
1
Benchmarks

Best Practices

Shift-Left Testing Manifesto

Encourages earlier testing (unit, security, performance) in the SDLC to catch defects sooner.

by Testing Community

Contract-Driven Development with Pact

Consumer-driven contract testing methodology to ensure micro-service compatibility.

by Pact Foundation

Hexagonal Architecture (Ports and Adapters)

An architecture that isolates core application logic behind ports, with adapters connecting external concerns like databases and UIs, so the core stays independent of technology.

by Alistair Cockburn

Data Quality Management

The practice of measuring, monitoring, and improving data across dimensions like accuracy, completeness, consistency, timeliness, and validity so it stays fit for use.

by DAMA International

LLM Evaluation and Evals

LLM evaluation measures model and application quality with repeatable tests, scoring accuracy, faithfulness, safety, and cost so teams can ship and improve with evidence.

by OpenAI

Component-Driven Development

A development approach that builds UIs bottom-up from isolated, reusable components, developed and tested independently before assembly into pages and apps.

by Tom Coleman / Chromatic

The Test Pyramid

A testing strategy that favors many fast unit tests, fewer integration tests, and a small number of slow end-to-end tests.

by Martin Fowler

The Testing Trophy

A testing model that weights integration tests most heavily, balancing static analysis, unit, integration, and end-to-end tests by confidence-per-cost.

by Kent C. Dodds

Test-Driven Development (TDD)

A development discipline where you write a failing test first, write minimal code to pass it, then refactor, in short red-green-refactor cycles.

by Kent Beck

Property-Based Testing

A technique that asserts general properties of code and lets a framework generate many randomized inputs to find counterexamples and shrink them.

by QuickCheck (Koen Claessen and John Hughes)

Mutation Testing

A technique that injects small faults (mutants) into code and checks whether tests detect them, measuring how effective the test suite really is.

by PIT (Pitest)

Flaky Test Management

A disciplined approach to detecting, quarantining, and fixing nondeterministic tests so CI signal stays trustworthy and developers keep merging.

by Google Testing Blog

Code Coverage Best Practices

Guidance on using code coverage as a signal of untested code rather than a target, including diff coverage and avoiding coverage gaming.

by Google Testing Blog

End-to-End Testing Best Practices

Guidance for writing reliable, maintainable end-to-end tests that exercise critical user journeys without becoming slow and flaky.

by Playwright (Microsoft)

Test Data Management

Practices for provisioning realistic, isolated, and compliant test data so tests are reliable, repeatable, and free of production data exposure.

by Thoughtworks

Visual Regression Testing

Automated testing that captures screenshots of UI states and compares them against baselines to detect unintended visual changes.

by BackstopJS

Tutorials

Testing with Vitest

Set up Vitest for fast, modern JavaScript testing

How to build and test a Node.js REST API with Jest and Supertest

Build a small Express REST API and test its endpoints with Jest and Supertest, including setup and teardown.

How to test a FastAPI application with pytest and TestClient

Test a FastAPI app's endpoints using pytest and the built-in TestClient, with fixtures and dependency overrides.

How to test a Go HTTP API with httptest

Write fast, isolated tests for a Go HTTP handler using the standard library's net/http/httptest package.

FAQs

What is the test pyramid?

The test pyramid is a guideline for balancing automated tests by type and quantity. Its wide base is many fast, cheap unit tests; the middle is a smaller number of integration tests that verify components working together; and the narrow top is a few slow, expensive end-to-end tests that exercise the whole system. The shape reminds teams to favor lower-level tests because they run quickly and pinpoint failures, while keeping costly UI-level tests to a minimum. An inverted or 'ice cream cone' distribution—too many e2e tests—tends to be slow and brittle.

What is the difference between unit, integration, and end-to-end tests?

Unit tests verify a single function or class in isolation, often with dependencies mocked, and run very fast. Integration tests check that multiple components work correctly together—for example, code talking to a real database—covering the seams that unit tests miss. End-to-end (e2e) tests exercise the entire application from the user's perspective, such as driving a browser through a full workflow, giving the highest confidence but the slowest, most fragile feedback. A healthy suite uses many unit tests, fewer integration tests, and a small set of e2e tests.

What is Test-Driven Development (TDD)?

Test-Driven Development (TDD) is a practice where you write a failing automated test before writing the code that makes it pass. The cycle is 'red, green, refactor': write a test that fails (red), write the minimal code to make it pass (green), then clean up the design while keeping tests passing (refactor). This keeps code testable, documents intended behavior, and builds a safety net of regression tests. The trade-off is discipline and upfront effort, which pays off most on logic-heavy code with clear requirements.

Generators

Test Suite Generator

Generate test cases to validate migrated code

Benchmarks

Test Generation Coverage

Measures quality and coverage of AI-generated test suites for migrated code