Nowadays developers are expected to write unit tests. While simple in theory, in practice writing high-quality unit tests can turn out to be a real challenge. This book will help.
This book explains in detail how to implement unit tests using very popular open source Java technologies: JUnit 5, TestNG, Mockito and AssertJ.
It presents a range of techniques necessary to write high quality unit tests – e.g. mocks, parametrized tests and matchers. It also discusses trade-offs related to the choices we have to make when dealing with some real-life code issues.
The book stresses the importance of writing readable and maintainable unit tests, and puts a lot of stress on code quality. It shows how to achieve testable code and to eliminate common mistakes by following the Test Driven Development (TDD) approach. Every topic discussed in the book is illustrated with code examples, and each chapter is accompanied by some exercises.
By reading this book you will:
If you buy the printed version of any "Practical Unit Testing" book, you can buy ePub + PDF for $10! Just send me a picture of the book on your desk.
If you want to buy electronic or paper versions of the Practical Unit Testing book for your team or company, then contact me regarding the final price, please.
Hi there!
My name is Tomek Kaczanowski, and I’m happy to present to you the results of my hard work. This book have been written on the basis of my experience as a senior Java developer, trainer, mentor, technical team leader and merciless code reviewer. :)
The book have been proofread by several TDD & Java experts, and corrected by a native speaker, so I feel pretty confident about recommending it. Okay then, let’s forget about modesty: I reckon these really are the best books dealing with unit tests on the market! I hope you’ll share my opinion - when you’ve read them! :)
Personally, I would have been really happy to have had the chance to read book like this some time ago: it would have spared me several grey hairs, for sure! :) I would also be happy if my colleagues were to read them and follow the advice they would find there... :)
Blog Twitter LinkedIn e-mailAhh... no matter how many times you check, there are always some bugs! See the errata.
Source code is available.