Looking for a practical, step-by-step guide to mastering TDD? "Test-Driven Development with Python" by Harry J.W. Percival is your essential resource.
If you're keen on understanding Test-Driven Development (TDD) and applying it to real-world applications, Test-Driven Development with Python by Harry J.W. Percival might be the guide you need. This book stands out for its practical, hands-on approach, walking you through the process of building an application from the ground up, starting with the very first failing test, all the way to deployment on a live server.
What sets this book apart from more theoretical texts is its focus on cultivating the TDD mindset. It's not just about teaching the mechanics of testing, but also about instilling a disciplined, iterative approach to development. Step by step, you'll learn to resist the temptation to rush through coding and instead embrace a slow, methodical pace. In TDD, the first step is always the same: write a test. This simple but powerful concept is at the heart of the book's philosophy.
The application example used throughout the book is built using a range of technologies: Django for the backend and the frontend, Selenium for functional testing, and Python's unittest framework for unit tests, with a touch of JavaScript thrown in. However, I opted to use pytest instead of unittest, as it offers a cleaner syntax and more flexibility. Nevertheless, the book provides a clear, step-by-step guide to writing tests, implementing functionality, and refactoring code until everything is green.
However, it's worth noting that this review is based on the 2nd edition of the book, which is beginning to show its age. With Django now well past version 5 and Selenium evolving rapidly, some examples in the book may need to be adapted to work with the latest versions. But this minor inconvenience is easily outweighed by the quality of the material. The good news is that a 3rd edition is in the works, set to release in mid-2025. This updated version promises to address these outdated examples and further refine the content. If you're eager to get started, you can also access the early release version.
Overall, Test-Driven Development with Python is an invaluable resource for anyone looking to build better applications while developing the TDD mindset.
Category: Non-fiction