Sean Dague, Dan Smith, and Jay Pipes (and Jay Pipes’ pug, Winnie) discuss mock best practices. They address common slip-ups and problems, lay out several different options for style, and explain what a good test unit looks like.
The start the conversation with a discussion on what a good test unit looks like. The general consensus is that small and explicit tests are preferred. Other best practices include:
- Generally, stick to having a unit test only test a single method
- When in doubt, test less, not more, within a single test method
- A good unit test will highlight crappy code, interfaces and assumptions
They also discussed styles for mocking, and argued against the big nested context style and instead recommended the nested test method that uses the method decorator mocks or using a fixture for the test.
- Demystifying Confidential Containers with a Live Kata Containers Demo - July 13, 2023
- OpenInfra Summit Vancouver Recap: 50 things You Need to Know - June 16, 2023
- Congratulations to the 2023 Superuser Awards Winner: Bloomberg - June 13, 2023