3 ms·
He's right, but he's conflating 100% code coverage with using mocks with writing tests. Always write tests. And strive for maxmium coverage. But make sure you
by jganetsk 9y ago
He's right, but he's conflating 100% code coverage with using mocks with writing tests.
Always write tests. And strive for maxmium coverage. But make sure you write the right kinds of tests:
- Don't overuse mocks. Mocks don't represent real conditions you would actually see in production. Favor using real dependencies over mocks.
- Don't overspecify your tests. Test only publicly specified parts of the contract. Things that you need to be true and that the callers of the module expect to be true. And yes, you will change the test when the contract changes.
- scottschulthess 9y agoOnly mock things that would be difficult to setup in a test, is my approach. Then also set up some other ci jobs for the difficult stuff when we have time.