A fantastic, definitive guide. It will boost your productivity and deployment effectiveness.
Effective Unit Testing is written to show how to write good tests—tests that are concise and to the point, expressive, useful, and maintainable. Inspired by Roy Osherove's bestselling The Art of Unit Testing, this book focuses on tools and practices specific to the Java world. It introduces you to emerging techniques like behavior-driven development and specification by example, and shows you how to add robust practices into your toolkit.
about this book
about the cover illustration
Part 1 Foundations
1. Chapter 1 The promise of good tests
1.1. State of the union: writing better tests
1.2. The value of having tests
1.3. Tests as a design tool
2. Chapter 2 In search of good
2.1. Readable code is maintainable code
2.2. Structure helps make sense of things
2.3. It’s not good if it’s testing the wrong things
2.4. Independent tests run easily in solitude
2.5. Reliable tests are reliable
2.6. Every trade has its tools and tests are no exception
3. Chapter 3 Test doubles
3.1. The power of a test double
3.2. Types of test doubles
3.3. Guidelines for using test doubles
Part 2 Catalog
4. Chapter 4 Readability
4.1. Primitive assertions
4.3. Bitwise assertions
4.4. Incidental details
4.5. Split personality
4.6. Split logic
4.7. Magic numbers
4.8. Setup sermon
4.9. Overprotective tests
5. Chapter 5 Maintainability
5.2. Conditional logic
5.3. Flaky test
5.4. Crippling file path
5.5. Persistent temp files
5.6. Sleeping snail
5.7. Pixel perfection
5.8. Parameterized mess
5.9. Lack of cohesion in methods
5.10. Summary 113
6. Chapter 6 Trustworthiness
6.1. Commented-out tests
6.2. Misleading comments
6.3. Never-failing tests
6.4. Shallow promises
6.5. Lowered expectations
6.6. Platform prejudice
6.7. Conditional tests
Part 3 Diversions
7. Chapter 7 Testable design
7.1. What’s testable design?
7.2. Testability issues
7.3. Guidelines for testable design
8. Chapter 8 Writing tests in other JVM languages
8.1. The premise of mixing JVM languages
8.2. Writing unit tests with Groovy
8.3. Expressive power with BDD tools
9. Chapter 9 Speeding up test execution
9.1. Looking for a speed-up
9.2. Speeding up test code
9.3. Speeding up the build
Appendix A: JUnit primer
Appendix B: Extending JUnit
© 2014 Manning Publications Co.
About the book
Effective Unit Testing teaches Java developers how to write unit tests that are concise, expressive, useful, and maintainable. Offering crisp explanations and easy-to-absorb examples, it introduces emerging techniques like behavior-driven development and specification by example.
Programmers who are already unit testing will learn the current state of the art. Those who are new to the game will learn practices that will serve them well for the rest of their career.
- A thorough introduction to unit testing
- Choosing best-of-breed tools
- Writing tests using dynamic languages
- Efficient test automation
- combo $39.99 pBook + eBook
- eBook $31.99 pdf + ePub + kindle
Changed the way I look at the Java development process. Highly recommended.
A common sense approach to writing high quality code.
Extremely useful, even if you write .NET code.
If unit tests are a nightmare for you, read this book!