Effective Unit Testing
W**N
Print quality is not good.
I found the print quality of this book is very bad. I could see obvious defects on the cover image. The text in the book is very light, like the ink cartridge is going out of ink. Maybe it's only the one I got.
S**Y
It's a good book to have on hand but don't expect it ...
It's a good book to have on hand but don't expect it to go into any depth using IoC or ORM tools with your testing strategies - see books on Spring and Hibernate for that.
G**T
Very helpful for test novices. NOT JUST Java but any unit tests
This book generalizes test writing methods and organizes everything in feasible pieces.And the concept of "smell" is amazingly helpful. Because it gives an easy and human understandable utility instead of theoretical and scattered approaches.MUST READ and MUST HAVE book!!!I apply the principles from this book to .NET and even to Salesforce Apex.
B**E
Will lead you to write better tests
Lasse Koskela has been working on his second book (first one: Test-Driven) for quite a while, but I think it was worth waiting. Effective unit testing is a nice follow-up book as it is not a book about how to test-drive your code or how to write unit tests, but it is a book about how to write *effective* unit tests. Lasse already assumes that you know how to write unit tests, perhaps have written a dozen already, but now you'll need to make them better.The book consists of three parts. The first part is basically an introduction. The second part is the core of the book and it contains a catalog of test smells (indications that you can improve your tests) and what to do about them. This part is about 100 pages, which is half the book. The third part is a misc chapter which contains three chapters that are useful, but didn't really belong anywhere and were grouped together in this part.The first part contains three chapters. The first chapter explains why you need to have well written non-smelly tests while the second chapter tries to explain what makes a good test. The third chapter is a bit off (in my opinion) as it explains mocking (using test doubles). For me, this chapter felt a bit off-track and could have been removed.The second part is a catalog of test smells. Each description of the test smell follows the same format: 1) Rough description, 2) Example, 3) How to remove the smell, 4) Summary. The smells in the catalog have been grouped into three chapters: 4) Readability, 5) Maintainability, and 6) Trustworthiness. Each of these chapters contain about 10 smells.To give an example: 4.4 is the smell called "Incidental detail". This is the test smell where the smell contains more detail than is needed for understanding the test. Some parts of the code are important for the test, whereas some parts of the code are not. The "What to do about it?" then explain several techniques on how to remove this detail and keep the test focused and to the point.The last part of the book contains three topics: 7) Testable Design, 8) Writing tests in other JVM languages, 9) Speeding up test execution. Each of these are sort-of unrelated, but they are useful. Testable design is obvious. Writing tests in other JVM languages shows that you can write tests in e.g. Groovy and this brings a couple of additional advantages to the tests. And finally, the speeding up tests chapter covers dives into why tests are slow and what you can do about it.All in all, I liked Lasse's book a lot. It was well written (like his first one). The code examples are mostly taken from real projects and open source development. And especially the catalog of smells brings a nice vocabulary to describing ugly tests. If everyone would just read and remember that chapter, then the quality and effectiveness of tests will definitively improve. Recommended for everyone who wants to improve on their testing! This book wasn't a wow book which describes a new concept, but it was a very very useful book. Therefore, 4 stars. Excellent.
J**Z
Excellent but not much new
I have read most of the unit testing and TDD books available. Lasse Koskela's older book "Test Driven" was one of my favorites. This book is the perfect follow up to that book. The two together will cover just about every scenario you will encounter during unit testing. His accessible, unambiguous and matter-of-fact writing style is a pleasure to read, and you will have no trouble learning the material.As far as specific details go, his suggestions on handling File interactions are quite useful. I also enjoyed the chapter on writing tests in other JVM languages. The chapter on "Testable Design" contains advice that is invaluable to every developer - assuming you haven't read it elsewhere before. That leads to my only complaint with this book. There just wasn't much that was completely new. If you are not as well read as I am in this topic, this book should be your second purchase, right after his first book. If you do have a fair bit of experience, its usefulness will be diminished.
J**Y
what to do and what not to do
"Effective Unit Testing" felt familiar to me. I think it is because I read "Test Driven" and saw the author present some of the content from this title at the 2012 Server Side Java Symposium. You can get a feel for some of the smells from my live blog post of that session [...]Part one sets the stage. It walks you through a hypothetical teams journey - no tests → tests → test driven! I liked the examples of bad code and bad test examples. And I really like the explanation of different types of test doubles. I also liked the example of jMock vs Mockito to do the same thing.Part two shows you a series of test smells and how to fix them. One of my favorites is something really simple. How to make a bowling example more readable by using method names so you can embed "magic values" in the code. I also particularly liked the segment on how parameterized tests can be an anti-pattern along with how to avoid this problem.Part three is "other things." It covers using other JVM languages to test and how to make your tests faster. Both via the tests and running them in the cloud. I really liked the part on how to profile in both Ant (which I knew) and Maven (which I haven't needed to yet.)While there is an appendix to get you up to speed on JUnit, you should read a different book if you are trying to get up to speed on JUnit. I recommend "JUnit in Action" or "Test Driven" for that. Once you know any unit testing framework, it is time to come back to this book so you can write better tests.It was a great book. My only problem was that having seen the session some was repetitive. But I highly recommend both the book and the talk.---Disclosure: I received a copy of this book from the publisher in exchange for writing this review on behalf of CodeRanch.
G**L
Good read
Nice book, easy to read and I think of value for both experienced and beginners
C**O
Love it
Very interesting it covers all the principle of unit testing.Good to have a macro view of the unit testing
B**K
Super
Absolut empfehlenswert. Ich habe jedes Kapitel mit Interesse gelesen, leider konnte ich bei der Testimplementierung in anderen JVM Sprachen nicht folgen, da mir hier die Kenntnisse fehlen und das Buch hier auch keine Einführung gibt :-( Sehr schade. Da hätte eventuell ein Kapitel mehr eventuell nicht geschadet. Trotzdem klasse und absolut empfehlenswert.
N**S
Senso comune ed esempi
Una raccolta di consigli di buon senso, arricchiti da qualche esempio molto specifico e raramente generalizzabile.Avrebbe potuto meritarsi 3 stelle, sintetizzato gli stessi concetti in meno pagine.
R**I
Pruebas de unidad necesarias
El libro es muy interesante y sobre todo práctico para aprender pruebas de unidad. El precio es demasiado bajo, para lo que el libro ofrece.Realmente es muy recomendable.
Trustpilot
4 days ago
1 month ago