Unit TestingVladimir Khorikov
Unit Testing
by Vladimir Khorikov · first published 2020
8mentions
3recommended by
4HN commenters
2021–2024first – last mentioned
75% recommend25% neutral
Affiliate links. As an Amazon Associate I earn from qualifying purchases.





'How do you unit test your code without mocks?' I strongly recommend reading "Unit Testing: Principles, Practices, and Patterns" by Vladimir Khorikov. That's going to answer your question and will unveil a whole world of testing without mocking (not that it's better or worse than with mocks).…
on “CUPID – the back story” ↗The four quadrants of code types as shown in the article also appear as Figure 7.1 in an excellent book on testing: Unit Testing Principles, Practices, and Patterns, by Vladimir Khorikov, January 2020. https://www.manning.com/books/unit-testing
on “Selective Unit Testing – Costs and Benefits (2009)” ↗For Elixir Dave Thomas has a video series https://codestool.coding-gnome.com/courses/elixir-for-progra... For a general programming book I recommend Unit Testing by Vladimir Khorikov https://www.manning.com/books/unit-testing which was recommended by Saša Jurić
on “Ask HN: Programming Courses for Experienced Coders?” ↗Great advice. I follow it in my coding efforts and it has never failed me. Great book about this: Unit Testing Principles, Practices, and Patterns, Vladimir Khorikov, 2020 https://www.manning.com/books/unit-testing
on “Database mocks are not worth it” ↗This rule is also recommended by section 9.2.4. "Only mock types that you own" of 2020 book by Vladimir Khorikov: "Unit Testing Principles, Practices, and Patterns". Worth noting is that book also says in 9.2.1: "Mocks are for integration tests only". I agree. In my opinion this book is the best comprehensive take on testing…
on “Don’t mock what you don’t own” ↗…agree with it. I have been championing it in my team of 20+ devs since many years now, to great effect. You can read more about it in the excellent book by Vladimir Khorikov from January 2020 titled "Unit Testing Principles, Practices, and Patterns".
on “Favor real dependencies for unit testing” ↗Unit Testing Principles, Practices, and Patterns by Vladimir Khorikov
on “Ask HN: Top 10 Timeless Software Books That ChangedLife as Software Engineer?” ↗Good question. Depends on the reference template, if there is one. Otherwise, Unit Testing: Principles, Practices, and Patterns (Khorikov 2020) suggests --- Let me repeat myself: coverage metrics are a good negative indicator, but a bad positive one. Low coverage numbers--say, below 60%--are…
on “Getting 100% code coverage doesn't eliminate bugs” ↗