Jump to ratings and reviews
Rate this book

Practical Unit Testing with JUnit and Mockito

Rate this book
This book explains in detail how to implement unit tests using two very popular open source Java technologies: JUnit and Mockito. 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 approach. Every topic discussed in the book is illustrated with code examples, and each chapter is accompanied by some exercises.

380 pages, Paperback

First published April 23, 2013

23 people are currently reading
206 people want to read

About the author

Tomek Kaczanowski

6 books7 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
43 (40%)
4 stars
48 (45%)
3 stars
10 (9%)
2 stars
4 (3%)
1 star
0 (0%)
Displaying 1 - 14 of 14 reviews
Profile Image for Erik Nilson.
15 reviews8 followers
October 29, 2019
This book offers many good tips on how to build high-quality code. More importantly, it hepls create a base framework of a MANUAL that a company could use to standardise the coding styles of its engineering force. One shouldn’t follow all the tips listed in the book, but the book surley gives nice directions.
Profile Image for Dmytro Chasovskyi.
89 reviews
July 24, 2019
I have tried several different books to read regarding unit-testing and specific testing in Java but this is a DIAMOND book. Exactly the one I looked for and needed. It goes into details, have exercises to master the material and is practical enough, so after reading I can jump into the code I am working with and will be already equipped with several techniques/tools that I didn't know/fully understand before.

I definitely recommend it for people with some experience in programming, not necessarily in Java and those who want to structure accumulated knowledge over years.
1 review4 followers
December 8, 2016
This is the best book I have read about Unit Testing in Java. It's very practical, so you are introduced to the concepts using concise escenarios. It uses examples of code closer of what you would find in enterprise OO applications.
Profile Image for Ciro Santoro.
7 reviews
December 6, 2017
I would recommend this book to anyone wanting to improve code quality by means of testability!
I really enjoyed reading this book as a developer.
Profile Image for Abdur Rahman.
11 reviews1 follower
March 10, 2019
I already had a decent bit of experience with Mockito and JUnit, but this book helped me gain a lot more perspective. A must read for unit testing in Java.
7 reviews
June 9, 2022
I am an experienced developer, and found this book to be quite useful. I intend to especially recommend it to all of the junior developers working for me.

It lays out how to do test driven development in a concise, but useful way, it gets into some of the benefits of JUnit, assertJ, and Mockito, among other frameworks.
Profile Image for Maxim Estonian.
2 reviews
March 11, 2018
Very practical, explanation of interactions in unit tests between SUT and DOCs is very helpful
Profile Image for Eduardo.
36 reviews
July 9, 2014
Libro muy completo sobre el Unit Testing. Sobre todo, muy práctico, muchos ejemplos. Me ha gustado mucho, más que el anterior que leí
87 reviews5 followers
July 29, 2015
Good with rare topics covered - like unit testing async and parallel code.
Displaying 1 - 14 of 14 reviews

Can't find what you're looking for?

Get help and learn more about the design.