Scaling Go Testing with Contract and Scenario Mocks

(funnelstory.ai)

12 points | by preetamjinka 6 days ago ago

1 comments

  • teeray 17 minutes ago

    > Mocks are static, but reality evolves.

    I learned “test your mocks” long ago from Sandi Metz, and that advice has paid off well for me. Have some set of behavioral conformance tests for the kind of thing you expect (e.g. any database worth its salt should be able write and read back the same record). Then stick your mock right under that same battery of tests alongside your implementation(s). If either deviate from the behavior you depend on, you’ll know about it.