Unit Testing Principles, Patterns and Practices shows you how to refine your existing unit tests by implementing modern best practices. You’ll learn to spot which tests are performing, which need refactoring, and which need to be deleted entirely! Upgrade your testing suite with new testing styles, good patterns, and reliable automated testing.
about the technology
Great testing practices will help maximize your project quality and delivery speed. Wrong tests will break your code, multiply bugs, and increase time and costs. You owe it to yourself—and your projects—to learn how to do excellent unit testing to increase your productivity and the end-to-end quality of your software.
about the book
Unit Testing Principles, Patterns and Practices teaches you to design and write tests that target the domain model and other key areas of your code base. In this clearly written guide, you learn to develop professional-quality test suites, safely automate your testing process, and integrate testing throughout the application life cycle. As you adopt a testing mindset, you’ll be amazed at how better tests cause you to write better code.
what's inside
Universal guidelines to assess any unit test
Testing to identify and avoid anti-patterns
Refactoring tests along with the production code
Using integration tests to verify the whole system
about the reader
For readers who know the basics of unit testing. The C# examples apply to any language.
about the author
Vladimir Khorikov is an author, blogger, and Microsoft MVP. He has mentored numerous teams on the ins and outs of unit testing.
concepts explained in this book
Mocking is a testing technique that replaces a dependency or collaborator with a controlled substitute to simulate behavior, isolate code, or inspect interactions.
A test double is a substitute for a real dependency or collaborator that provides controlled behavior or enables interaction observation during testing.
An application service is a software component that provides or coordinates application-level functionality for callers, typically by coordinating operations and interactions with other components.
An implementation detail is an internal design, representation, or mechanism describing how software realizes behavior, rather than part of its externally observable behavior or contract.
A brittle test is a test that is unusually prone to failure from incidental conditions or implementation changes even when the tested behavior remains correct.
Behavior is the observable actions, responses, outputs, or effects of a system or object under specified conditions or interactions.
A false positive is a positive result that incorrectly indicates a target condition is present when it is absent.
State-based testing is a testing style that verifies behavior by examining the observable state of the system or its collaborators after an operation.