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
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.
Acceptance-criteria
Acceptance Criteria explained. Acceptance criteria are the specific conditions that a user story or feature must satisfy to be considered "do...
Acceptance-testing
Acceptance Testing explained. Acceptance testing is the process of verifying that a software system meets business requirements and is ready...
Accessibility-statement
Accessibility Statement explained. An accessibility statement is a public declaration on a website or application that describes: the accessibili...
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.
Api-contract
API Contract explained. An API contract is a formal specification of how an API behaves — defining: available endpoints, request forma...
Get Expert Advice on Mock-testing
Speak with our UK software development experts about Mock-testing. Free consultation, transparent pricing, no obligation.