Tags: unit testing
Unit Testing:
We want to eliminate outside dependencies as much as possible when testing a single component in isolation.
Use Stubs and Mock objects to build a harness around the component. Working test first, and designing our components to be testable in isolation significantly reduces their coupling with each other. Tests are first class clients of the code, so the code often changes in response to the requirements of the tests. The tests are the first client of the code, the second is usually the application, and if re-used there can be many other clients.
See DependencyInversionPrinciple
Testing at the unit level ensures that when integration begins we can have confidence in the functinality of each component being integrated.
Always test each application with xUnit (http://www.junit.org), whether it is part of a bigger system, or standalone.
Last published: Wednesday 7th December 2011
<<Previous Next>>