Testing and Data Validation Using Generated Code
summary
Demonstrates building and using a new mock generator called minimoc that emits Go mocks as first class function fields, a builder API, concurrent-safe execution counters and finish and wait helpers tied into testing.T. Compares existing tools mockery gomock counterfeiter and an iface extractor, shows live coding of tests that compile and pass, and reports generated test code is about 11x more code than the 30-line service while tests themselves are 3x larger.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:52Generating interfaces
- 4:05Table test generation
- 4:48Mocking dependencies issues
- 7:01Introducing minimoc
- 14:00Live coding demo
- 23:08Debugging the test
- 24:13Finishing mock setup
- 26:38Storage not found case
- 28:25Locator failure case
- 31:30Successful case with wait
- 34:03Code generation cost
- 35:37Q&A
