Test-First Techniques Using xUnit and Mock Objects
Unit testing, typically considered a Quality Assurance practice, is now being considered by some to be a tool developers can use to move their process forward (often termed "test-driven development").
However, there are aspects of many/most projects that are inherently difficult to test: namely those classes with dependencies on other classes or components whose behavior is difficult or impossible to predict. These ("ephemeral") dependencies, to databases with unknown values, or GUI's with unpredictable behavior, etc..., can make testing arduous or even impossible without special techniques, such as the use of mock objects.
This seminar addresses the concept of the unit test as a developer's tool, and in particular how the use of mock objects can help to ameliorate the difficulties that dependencies can create in testing. For our demonstrations and investigations we use Java, Junit, and EasyMock, though there are similar tools for every popular development language/platform.
Learn:
- The basics of Unit Testing and the JUnit testing tool
- How test can be used by developers (test-driven development), and how this differs from traditional QA testing
- How dev-test and QA-test are actually compatible and synergistic
- What Mock Objects are, and how they help solve ephemeral dependencies and other unit testing difficulties
- The EasyMock framework, how to get it and use it effectively
- Possible next steps in the evolution of test-driven development