But if you prefer JUnit over TestNG or PowerMock over Mockito, it is still a valid and a very good source of information about proper and painless testing. But of course, TestNG and Mockito users will be able to get most of this title. Below you can read some of my thoughts after reading this book. Quick look at content Tomek Kaczanowski , author of this book, starts with describing some basic concepts needed to understand testing and classification of tests.
|Published (Last):||6 December 2016|
|PDF File Size:||2.23 Mb|
|ePub File Size:||5.27 Mb|
|Price:||Free* [*Free Regsitration Required]|
Author: Software Development Books Category: Quality 7 May 12 According to the author, this book is aimed at developers who want to produce high-quality, maintainable unit tests. It is intended especially for those who would like to start unit testing their code, but are unsure about how to get started and what to focus on.
The book discusses general topics of unit testing and mocking, providing examples created with the TestNG and Mockito tools. My preferred part is the one dedicated to test maintainability and test code quality that deals with aspect of software testing that are less visible in the available literature.
The book is well written and structured, with a dose of humor. Exercises are suggested and a summary is provided at the end of each chapter. I also liked the approach of the author to have an open view on unit testing and presenting all the available choices for testing strategies or tools selection instead of just pushing his own opinion.
This book is highly recommendable to all software developers interested in unit testing, particularly if you are working in a Java context.
But be warned — there is a catch! This deceptive ease of use leads many developers to assume that they know how to test, just because they can use testing tools — i. This is plainly wrong. Tools can be used mindlessly, or they can be used by a skilled hand. They can dominate you or they can become your obedient servants. If you think about it, you will realize that writing a test after a bug has been found really amounts to a test-first approach.
You write a test which fails because you want to mimic the bug , and then you implement the code. Applications maintainability — the holy grail of software development! We write code every day, trying to make it so good it will withstand the test of time. We hope that we, or our colleagues, working with this code sometime in the future, will be able to understand it at a glance.
We hope to be able to introduce changes easily without causing chaos throughout the entire application. We should write our tests with the same attitude, trying to make them maintainable. Because, as we have already discussed, they play a crucial role in supporting and documenting our production code.
Another point worth remembering is that there is a strong relation between the quality of your production code and test code. Having good, clean, maintainable tests is definitely possible. The first step is to write cleaner, better designed and truly loosely-coupled production code.
If the production code is messy, then there is a considerable likelihood that your tests will also be. If your production code is fine, then your tests have a chance of being good, too. The second step is to start treating your test code with the same respect as your production code.
Practical Unit Testing with TestNG and Mockito
Using Mockito with TestNG
Practical Unit Testing with TestNG and Mockito – Review