First, I’d like to present an experience report about real-life development with mock objects: the test-driven struggle. Then I will show how to improve the TDD experience and code quality through a slightly different approach to mocking: taking a step back from the invasive nature of interaction based testing and getting closer to the way we do state based testing. Finally, I will introduce a new mock library for java: Mockito which was driven by these observations. Mockito implements what Gerard Meszaros calls a Test Spy.
Process in short:
Experience report (shows the problem) -> tutorial of a new tool (tries to fix the problem)
Prerequisites: Laptop (including power cable!), Java 5 development environment
This hands-on tutorial teaches Test-Driven Development, using Mock Objects to drive the discovery of roles and responsibilities in the code.