General Overview
Vladimir Khorikov's book "The Principles of Unit Testing" is dedicated to a systematic and thoughtful approach to automated code testing. The author examines unit testing not as a set of tools or frameworks, but as an engineering discipline closely tied to application architecture, code quality, and the long-term maintainability of the system.
The book thoroughly breaks down the fundamental principles of good tests: isolation, reliability, readability, and their value to the project. Special attention is given to the distinction between unit and integration tests, as well as where the line between them is drawn in practice. The author systematically explains why the desire to test "everything under the sun" often leads to brittle and useless tests.
A significant portion of the book is dedicated to the architectural aspects of testing. It shows how code structure, dependencies, and design style directly impact the complexity of writing and maintaining tests. Various approaches to dependency isolation, types of test doubles, and their areas of application are examined.
The book also analyzes testing metrics, such as code coverage, and explains why high coverage numbers alone do not guarantee quality. The author focuses on test refactoring, keeping them up-to-date, and preventing the test base from degrading over time.
The book is aimed at developers who want to deepen their understanding of testing's role in the development process and learn to write tests that truly benefit the project, rather than creating an additional burden.
Opinion
A good book on testing code. Besides unit tests, it also pays a lot of attention to integration tests. The London and Classical schools of testing are analyzed in detail. It breaks down the difference between code coverage and branch coverage, describes what requirements tests should meet, what kinds of test doubles exist and how mocks differ from stubs, the different styles of unit testing, how to properly refactor tests, how project architecture affects tests, and much more. So, if you think you know testing well, I'm sure you'll find plenty of interesting things in this book.