Mockolo: Efficient Mock Generator for Swift
summary
Builds a fast Swift mock generator that parses with SourceKitten, limits concurrency with a dispatch semaphore to core count, and uses simple string interpolation templates instead of Stencil. Targets a 2M-line codebase with ~11,000 protocols, needing ~9,000 mocks (~0.5M generated lines); existing tools took ~1 hour, the new tool runs ~5s multi‑threaded (about +12s single‑threaded). Resolves inheritance by precomputing dependency outputs, generates models lazily, supplies default return values, and integrates into the build system.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 0:45What is Mockolo
- 13:03Resolving Inheritance
- 16:52Rendering
- 20:42Profiling
- 23:18Recap
- 25:13Issue with SourceKit
- 27:02Benchmarking
- 30:20Apples priorities
- 31:37Compile time
- 32:52Swift syntax
related talks
26mMocka - A Mock Server for Developers by Developers
52mPlease don’t mock me
50mThe Best Mock in the World: Examining Tools for Generating Mocks in Go
24mMaking Mock Objects More Useful
33mGraphQL mocking and why it is important for developer productivity.
16mHow I Started Mocking My GraphQL Schema
15mMocking of Internal Functions in Solidity Unit Tests
22mMocking and automocking for tests and storybooks
