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)
After one or two years of development, many applications become excessively difficult to change. Developers waste a significant portion of their time fighting “cognitive friction” - looking for code, figuring out how to reuse existing code, understanding new APIs, making and fixing mistakes, etc. In this session, you will learn, through concrete examples, how to apply usability principles to reduce cognitive friction, helping you write code that does not become an obstacle to agility. You will take home a number of techniques that you can start applying right away.
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.