StackPractices

testing

Practical resources about testing for software engineers.

90 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

Set Up Pre-Commit Hooks with husky and lint-staged

Set up production-ready pre-commit hooks with husky, lint-staged and the pre-commit framework....

devops git pre-commit husky
beginner

Mock GraphQL Resolvers for Frontend Development

Set up mocked GraphQL resolvers with Apollo Server so frontend teams can develop against a fake API...

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...

intermediate

Test API Contracts with Consumer-Driven Contracts

How to prevent breaking changes between microservices using consumer-driven contract testing with...

testing api-testing consumer-driven-contracts unit-tests
intermediate

API Mocking for Testing

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

beginner

Generate Test Data

How to generate realistic, deterministic test data with Faker, factory-boy, and type-aware...

advanced

Implement Mutation Testing

How to use mutation testing with MutPy, Stryker, and PIT to evaluate whether your tests actually...

intermediate

Implement Property-Based Testing

How to write property-based tests with Hypothesis, fast-check, and jqwik that generate thousands of...

testing property-based-testing hypothesis fast-check
intermediate

Write Integration Tests

How to test multiple components working together using real databases, HTTP clients, and message...

intermediate

Design Effective Integration Tests for Reliable Systems

How to write integration tests that verify component interactions using test containers, API...

testing api-testing consumer-driven-contracts unit-tests
intermediate

JUnit5 Soft Assertions with AssertJ

How to use AssertJ soft assertions in JUnit5 to collect multiple assertion failures in a single...

advanced

Java Testcontainers Integration Tests

How to use Testcontainers in JUnit5 to spin up real Postgres, Redis, and Kafka containers for...

intermediate

Stub External HTTP APIs with WireMock in Java

Use WireMock in Java tests to stub external HTTP services. Covers response templating, delay...

intermediate

Mock Network Requests with MSW

How to use Mock Service Worker (MSW) to intercept network requests in JavaScript tests and...

intermediate

Vitest Snapshot Testing for React

How to use Vitest snapshot testing to catch unintended UI changes in React components, including...

beginner

Snapshot Testing React Components with Jest

How to use Jest snapshot testing to catch unintended UI regressions in React components and prevent...

intermediate

Perform Load Testing on APIs

How to simulate realistic traffic, measure response times, and identify bottlenecks using k6 and...

beginner

Measure Test Coverage

How to measure, report, and enforce code coverage with branch and condition coverage using...

intermediate

Test Express APIs with supertest

How to test Express.js REST API endpoints end-to-end using supertest, including status codes, JSON...

beginner

Measure and Enforce Python Test Coverage with pytest-cov

Measure and enforce coverage with pytest-cov: branch coverage, HTML reports, exclusions, CI...

No results found.