What is Mock (Testing)? — UK Software Development Guide
Direct Answer
A mock (or mock object) is a simulated object in software testing that mimics the behaviour of a real dependency — allowing code to be tested in isolation. Mocks are typically used in unit tests to replace real dependencies (databases, APIs, external services) with controlled substitutes that return predetermined responses.
Mock-testing in the UK
Mocking has direct implications for UK compliance testing. UK government APIs (HMRC MTD, NHS Spine, GOV.UK Pay) provide sandbox environments that serve as "real mocks" — enabling integration testing without using production systems. For UK GDPR: unit tests should use mock personal data (synthetic data), not real personal data — using real customer records in test environments is a UK GDPR violation. DTAC Domain 3 expects evidence of comprehensive testing — mock-based unit tests are a key component of that evidence.
Related Glossary Terms
API
API explained for UK software developers and business owners. An API (Application Programming Interface) is a defined set of rules and protocols that allows different software system... UK context, examples, and related services.
MVP
MVP explained for UK software developers and business owners. An MVP (Minimum Viable Product) is the smallest version of a product that allows you to validate your core business assu... UK context, examples, and related services.
Microservices
Microservices explained for UK software developers and business owners. Microservices architecture is a software design approach where an application is built as a collection of small, indepen... UK context, examples, and related services.
Open Banking
Open Banking explained for UK software developers and business owners. Open Banking is the UK's implementation of PSD2 (Payment Services Directive 2) — a regulatory framework that requires th... UK context, examples, and related services.
GRAPHQL
GraphQL explained for UK software developers. GraphQL is a query language for APIs and a server-side runtime for executing those queries, developed by Meta (Facebook)... UK context and related services.
Wcag
WCAG 2.1 explained for UK software developers. WCAG (Web Content Accessibility Guidelines) 2.1 is the international standard for web accessibility published by the W3C... UK context and related services.
Get Expert Advice on Mock-testing
Speak with our UK software development experts about Mock-testing. Free consultation, transparent pricing, no obligation.