[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"glossary-mocking::en":3,"gloss-cluster-mocking::en":23,"gloss-next-mocking::en":9},{"slug":4,"category":5,"name":6,"definition":7,"meta_desc":8,"faq":9,"schema_markup":9,"related":10},"mocking","dev-tools","Mocking (Test Doubles)","Mocking is the practice of replacing a real dependency in a test with a controllable stand-in — a \"test double\" — so you can test one piece of code in isolation without invoking slow, unreliable, or expensive external systems. Instead of calling a real payment gateway or database in a unit test, you swap in a mock that returns predetermined responses and lets you assert how it was called. This makes tests fast, deterministic, and able to simulate hard-to-reproduce cases like a network timeout or a 500 error. Mocks, stubs, fakes, and spies are all flavors of test doubles with slightly different jobs. For AI\u002FSaaS builders, mocking is how you unit-test code that talks to third-party APIs — Stripe, an LLM provider, an email service — without hitting them on every run. Practical note: don't over-mock. If you mock everything, your tests verify your assumptions about a dependency rather than reality, so keep some end-to-end tests that exercise the real integrations too.","Mocking replaces a real dependency in a test with a controllable stand-in, so you can test one unit without calling a slow or costly external system.",null,[11,14,17,20],{"slug":12,"name":13},"code-coverage","Code Coverage",{"slug":15,"name":16},"dependency-injection","Dependency Injection",{"slug":18,"name":19},"end-to-end-testing","End-to-End Testing",{"slug":21,"name":22},"unit-test","Unit Test",[24,28,31,35,38,41,44,47,50,53,56,59],{"slug":25,"category":5,"name":26,"updated_at":27},"agent","Agent","2026-08-24T02:46:36+00:00",{"slug":29,"category":5,"name":30,"updated_at":27},"ai-code-assistant","AI Coding Assistant",{"slug":32,"category":5,"name":33,"updated_at":34},"api-gateway","API Gateway","2026-08-24T02:46:37+00:00",{"slug":36,"category":5,"name":37,"updated_at":34},"api-versioning","API Versioning",{"slug":39,"category":5,"name":40,"updated_at":27},"autonomous-agent","Autonomous Agent",{"slug":42,"category":5,"name":43,"updated_at":34},"blue-green-deployment","Blue-Green Deployment",{"slug":45,"category":5,"name":46,"updated_at":34},"canary-deployment","Canary Deployment",{"slug":48,"category":5,"name":49,"updated_at":34},"chaos-engineering","Chaos Engineering",{"slug":51,"category":5,"name":52,"updated_at":27},"ci-cd","Continuous Integration \u002F Continuous Deployment (CI\u002FCD)",{"slug":54,"category":5,"name":55,"updated_at":34},"circuit-breaker","Circuit Breaker",{"slug":57,"category":5,"name":58,"updated_at":34},"cli","Command-Line Interface (CLI)",{"slug":60,"category":5,"name":61,"updated_at":34},"cloud-development-environment","Cloud Development Environment (CDE)"]