Skip to content
StackPractices

testing

Practical resources about testing for software engineers.

89 results

Testing Strategies That Ship with Confidence

Testing is not just about catching bugs — it is about shipping faster, refactoring without fear, and documenting behavior through executable specs. A well-tested codebase reduces incident response time and onboarding friction for new developers.

Explore recipes for unit testing with mocks, integration testing with real dependencies, end-to-end testing with Playwright, and load testing with k6. Each pattern includes setup instructions, assertion strategies, and CI/CD integration tips.

beginner

Mock GraphQL Resolvers for Frontend Development

Set up mocked GraphQL resolvers with Apollo Server so frontend teams can develop against a fake API before the backend is ready

intermediate

Load Testing APIs with k6 and Threshold-Based Assertions

How to write and run load tests with k6 to measure API performance, validate SLOs, and identify bottlenecks before production deployment

intermediate

Test API Contracts with Consumer-Driven Contracts

How to prevent breaking changes between microservices using consumer-driven contract testing with Pact and OpenAPI validators.

intermediate

API Mocking for Testing

Build reliable tests by mocking external APIs with WireMock, MockServer, and MSW to eliminate flakiness and test edge cases.

beginner

Generate Test Data

How to generate realistic, deterministic test data with Faker, factory-boy, and type-aware generators for reliable test suites in Python, JavaScript, and Java.

advanced

Implement Mutation Testing

How to use mutation testing with MutPy, Stryker, and PIT to evaluate whether your tests actually assert behavior or merely execute code.

intermediate

Implement Property-Based Testing

How to write property-based tests with Hypothesis, fast-check, and jqwik that generate thousands of inputs to find edge cases traditional tests miss.

intermediate

Write Integration Tests

How to test multiple components working together using real databases, HTTP clients, and message queues in Python, JavaScript, and Java.

intermediate

Design Effective Integration Tests for Reliable Systems

How to write integration tests that verify component interactions using test containers, API contracts, consumer-driven contracts, and contract testing in Java, TypeScript, and Python.

intermediate

JUnit5 Soft Assertions with AssertJ

How to use AssertJ soft assertions in JUnit5 to collect multiple assertion failures in a single test instead of stopping at the first failure.

advanced

Java Testcontainers Integration Tests

How to use Testcontainers in JUnit5 to spin up real Postgres, Redis, and Kafka containers for integration tests that are reliable and reproducible.

intermediate

Stub External HTTP Services with WireMock

How to use WireMock in Java tests to stub external HTTP services, including response templating, delay simulation, and stateful mock behavior.

intermediate

Mock Network Requests with MSW

How to use Mock Service Worker (MSW) to intercept network requests in JavaScript tests and development, including REST and GraphQL mocking.

intermediate

Vitest Snapshot Testing for React

How to use Vitest snapshot testing to catch unintended UI changes in React components, including inline snapshots and snapshot updating workflows.

beginner

Snapshot Testing React Components with Jest

How to use Jest snapshot testing to catch unintended UI regressions in React components and prevent visual bugs from reaching production

intermediate

Perform Load Testing on APIs

How to simulate realistic traffic, measure response times, and identify bottlenecks using k6 and JMeter for APIs and web services.

beginner

Measure Test Coverage

How to measure, report, and enforce code coverage with branch and condition coverage using pytest-cov, nyc, and JaCoCo for meaningful quality gates.

intermediate

Test Express APIs with supertest

How to test Express.js REST API endpoints end-to-end using supertest, including status codes, JSON bodies, headers, authentication, and error handling.

beginner

Measure Test Coverage with pytest-cov

How to measure and enforce Python test coverage thresholds with pytest-cov, including branch coverage, HTML reports, exclusions, and CI integration.

advanced

Property-Based Testing with Hypothesis

How to use Hypothesis for property-based testing in Python, generating hundreds of test cases automatically from strategies instead of writing them by hand.

intermediate

Mock External APIs with responses Library

How to mock HTTP API calls in Python tests using the responses library, including status codes, headers, JSON bodies, and error simulation.

intermediate

Pytest Fixtures and Parametrize

How to use pytest fixtures and @pytest.mark.parametrize to write data-driven tests with reusable setup logic across Python projects.

beginner

Setup Test Fixtures

How to manage test fixtures with factory patterns, setup/teardown hooks, and deterministic data for reliable unit and integration tests across Python, JavaScript, and Java.

beginner

Unit Testing

How to write fast, deterministic unit tests with mocks and assertions in Python, JavaScript, and Java.

beginner

Write Unit Tests with Mocks and Stubs

How to isolate code under test using mock objects, stubs, and spies to replace external dependencies like databases, APIs, and file systems.

advanced

Contract Testing: Verify Consumer-Producer API Contracts

How to use contract testing to verify that API producers and consumers agree on request and response shapes. Covers Pact consumer-driven contracts and provider verification.

beginner

Fixture Setup/Teardown: Reusable Test Context Lifecycle

How to use setup and teardown fixtures to create reusable test context. Covers beforeEach, factory functions, fixture objects, and cleanup with examples.

advanced

Golden Master Testing

How to use golden master testing to characterize legacy code behavior before refactoring. Covers capturing output, comparing baselines, and incremental refactoring.

intermediate

Mock Server: Stand Up a Mock Server for Integration Test

How to use mock servers to isolate integration tests from external dependencies. Covers WireMock, nock, MSW, and Mountebank with configuration examples.

beginner

Parameterized Test: Run the Same Logic Across Multiple

How to write parameterized tests to verify the same logic across multiple inputs. Covers pytest parametrize, Jest test.each, JUnit ParameterizedTest, and data providers.

intermediate

Snapshot Testing: Capture and Compare Serialized Output

How to use snapshot testing to detect unintended changes in serialized output. Covers Jest snapshots, pytest snapshot, and inline vs external snapshots.

intermediate

Test Double: Replace Dependencies with Stubs, Spies, Fakes

How to use test doubles to isolate units under test. Covers stubs, spies, fakes, mocks, and dummy objects with examples in Python, JavaScript, and Java.

intermediate

Test Pyramid: Balance Unit, Integration

How to structure a test suite using the test pyramid. Covers unit, integration, and E2E test proportions, the testing trophy, and ice cream cone anti-pattern.

intermediate

Data Governance Policy Template

A template for data classification, retention, access control, privacy, and compliance policies covering GDPR, CCPA, and SOC 2 requirements.

intermediate

Data Pipeline Design Document Template

A template for documenting data pipeline sources, transformations, sinks, scheduling, error handling, and monitoring with schema definitions.

intermediate

Data Quality Rules Template

A template for defining data validation rules per dataset and column: completeness, consistency, accuracy, timeliness, and uniqueness checks.

intermediate

ETL Job Runbook Template

A runbook for operating, monitoring, and troubleshooting ETL jobs: startup, shutdown, health checks, common failures, diagnostics, and recovery.

intermediate

CI/CD Pipeline Design Template

A template for documenting CI/CD pipeline stages, gates, environments, deployment strategies, rollback procedures, and security scanning.

beginner

Code Review Checklist Template

A structured checklist template for conducting consistent, thorough code reviews that catch bugs, improve readability, and share knowledge across the team.

intermediate

Helm Chart Review Checklist

A checklist for reviewing Helm charts covering values, templates, security, resource limits, probes, RBAC, and best practices.

intermediate

Kubernetes Pod Disruption Budget Template

A template for defining Pod Disruption Budgets to control voluntary disruptions during node drains, upgrades, and maintenance windows.

intermediate

Penetration Test Scope Template

A template for defining the boundaries, targets, rules, and deliverables for a penetration testing engagement.

intermediate

Terraform State Management Policy

A policy for managing Terraform state files: backend configuration, locking, isolation, access control, versioning, and disaster recovery.

intermediate

Accessibility Audit Checklist

A WCAG 2.2 compliance checklist covering perceivable, operable, understandable, and robust criteria with testing tools and remediation steps.

intermediate

Browser Support Matrix Template

A template for tracking browser support targets, feature compatibility, polyfill requirements, and fallback strategies across the browser matrix.

intermediate

Component API Documentation Template

A template for documenting UI component APIs: props, events, slots, methods, accessibility, and usage examples with TypeScript types.

intermediate

Frontend Performance Budget Template

A template for defining JS, CSS, image, and font budgets per route with enforcement strategies and monitoring thresholds.

intermediate

Alert Runbook Template

A standardized runbook for responding to alerts: triage, diagnosis, mitigation, resolution, and post-incident steps with escalation paths.

intermediate

Dashboard Design Template

A template for designing observability dashboards with SLOs, error budgets, service health, and contextual information for on-call teams.

intermediate

Incident Postmortem Template

A blameless postmortem template for documenting incidents: timeline, impact, root cause, contributing factors, and action items with owners.

intermediate

Observability Maturity Assessment Template

A template for assessing logging, metrics, and tracing maturity across teams with scoring, gap analysis, and improvement roadmap.

intermediate

Load Test Plan Template

Template for planning and documenting load tests: test scenarios, user journey definitions, ramp-up strategies, success criteria, monitoring setup, tool selection (k6, JMeter, Locust), result analysis, and reporting with code examples for each tool.

intermediate

Access Control Policy Template

A template for defining authentication, authorization, RBAC, ABAC, MFA, password policies, session management, and access review procedures.

advanced

Encryption Key Rotation Runbook

A runbook for encryption key rotation covering key types, rotation schedules, zero-downtime procedures, dual-key migration, verification, and rollback.

intermediate

Incident Response Plan Template

A template for incident response covering severity classification, roles, detection, containment, eradication, recovery, and post-incident review procedures.

intermediate

Penetration Test Report Template

A template for penetration test reports covering scope, methodology, findings, severity ratings, evidence, and remediation recommendations.

intermediate

Security Audit Checklist

A checklist for security audits covering network security, application security, data protection, access control, monitoring, incident response, and compliance.

intermediate

Security Incident Response Template

A template for security incident response covering detection, classification, containment, eradication, recovery, communication, and post-incident review.

intermediate

Vulnerability Management Process Template

A template for vulnerability management covering discovery, triage, prioritization, remediation SLAs, verification, and reporting procedures.

intermediate

API Testing Strategy Template

A template for planning contract tests, integration tests, and load tests for APIs.

beginner

Bug Reproduction Steps Template

A template for writing minimal, reliable bug reproduction steps that help developers reproduce and fix issues quickly.

beginner

Load Test Report Template

A standardized template for documenting load test results and recommendations.

intermediate

Regression Test Checklist

A checklist for verifying existing functionality after changes: pre-deploy checks, post-deploy smoke tests, and rollback verification.

beginner

Test Case Template

A standardized test case format with steps, expected results, preconditions, and postconditions for manual and automated testing.

intermediate

Test Coverage Report Template

A template for reporting test coverage by module, feature, and critical path with trend analysis and gap identification.

intermediate

Test Strategy Document Template

A template for documenting test approach per project: pyramid, scope, environments, tools, CI/CD gates, and quality metrics.

advanced

Complete Guide to AI Agents in Production

Build production AI agents. Covers agent architectures, tool use, planning, memory, multi-agent systems, ReAct patterns, function calling, human-in-the-loop, safety, and deployment patterns for reliable autonomous agents.

advanced

Complete Guide to LangChain in Production

Run LangChain in production. Covers chains, agents, memory, tools, LCEL, streaming, callbacks, RAG integration, evaluation, and deployment patterns for reliable LangChain-powered applications.

advanced

Complete Guide to LLM Evaluation

Evaluate LLM applications in production. Covers RAGAS, LLM-as-judge, human evaluation, A/B testing, hallucination detection, toxicity scoring, regression testing, and building automated evaluation pipelines.

advanced

Complete Guide to GraphQL Testing

Test GraphQL APIs at every layer: unit tests for resolvers, integration tests for schema, E2E tests for operations. Covers mocking, fixtures, snapshot testing, and performance testing.

intermediate

Clean Code: Naming, Functions, Classes, Comments

Master clean code principles: meaningful naming, small functions, single responsibility, comments, formatting, error handling, and production code quality patterns.

intermediate

Code Reviews: Reviewer Mindset, Feedback, Automation

Master code review best practices: reviewer mindset, constructive feedback, review checklists, automated checks, PR sizing, and building a strong review culture in engineering teams.

intermediate

Refactoring Guide: Extract Method, Replace Conditional,

Master refactoring techniques: extract method, replace conditional with polymorphism, move function, extract class, rename, and safe refactoring workflows with tests.

intermediate

Technical Debt: Track, Prioritize, Pay Down

Master technical debt management: identify debt types, track with debt registers, prioritize using impact vs effort, schedule paydown sprints, and measure debt reduction.

advanced

Complete Guide to Go Concurrency

Master Go concurrency in production. Covers goroutines, channels, context, select, sync primitives, worker pools, pipelines, fan-out/fan-in, and patterns for high-throughput concurrent Go applications.

advanced

Complete Guide to Java Concurrency

Master Java concurrency in production. Covers threads, locks, CompletableFuture, virtual threads, executors, concurrent collections, memory model, and patterns for high-throughput parallel applications.

advanced

Complete Guide to Python Asyncio in Production

Run Python asyncio in production with confidence. Covers event loops, task management, debugging, cancellation, timeouts, backpressure, and patterns for high-concurrency async applications.

advanced

Chaos Engineering — Principles, Tools, and Safe Experiments

A practical guide to chaos engineering: build resilient systems by intentionally injecting failures. Learn the five principles, Litmus, Gremlin, and Chaos Mesh.

intermediate

CI/CD Pipeline Guide

A practical guide to building CI/CD pipelines with GitHub Actions, testing, deployment strategies, and rollback procedures.

intermediate

Complete Guide to CI/CD with GitHub Actions

Build CI/CD pipelines from scratch with GitHub Actions. Covers workflows, runners, matrix builds, caching, secrets, environments, deployment strategies, and reusable workflows.

intermediate

Blameless Postmortems: Learning from Incidents Without Blame

A practical guide to conducting blameless postmortems: capturing timelines, identifying root causes, writing useful follow-ups, and building a culture of continuous improvement from outages.

intermediate

Secure Coding Practices — By Language and Pattern

A practical guide to secure coding practices across languages: input validation, memory safety, authentication, and defensive patterns for Python, Java, JavaScript, and Go.

intermediate

JUnit 5: Extensions, Parameterized Tests, Dynamic Tests

Master JUnit 5 for modern Java testing: extensions model, parameterized tests, dynamic tests, test interfaces, lifecycle, conditional execution, and JUnit Platform integration.

advanced

Property-Based Testing Guide

Master property-based testing with Hypothesis (Python), fast-check (TypeScript), and QuickCheck principles. Generate test cases automatically, find edge cases, and shrink failures.

intermediate

Pytest in Production Guide

Master pytest for production codebases: advanced fixtures, plugins, custom markers, parametrized tests, parallel execution with pytest-xdist, and CI integration.

advanced

Testcontainers: Real Dependencies in Integration Tests

Master Testcontainers for integration testing with real databases, message brokers, and APIs. Covers Java, Python, and Node.js with Docker-based test fixtures.

intermediate

Vitest for React: Component, Hook, and Integration Testing

Master Vitest for React testing: component tests with Testing Library, hook tests with renderHook, integration tests, mocking, snapshot testing, and parallel execution.

beginner

Test-Driven Development (TDD) — A Practical Workflow

Learn TDD step by step: write a failing test, make it pass, refactor. Red-Green-Refactor with real examples in Python, JavaScript, and Java.

intermediate

Software Testing Strategy Guide

A practical guide to building a layered testing strategy with unit, integration, and end-to-end tests.