Breaking dependencies without breaking bones
When you start writing tests (especially unit tests) for existing code, what comes in your way is always dependencies. The talk presents several dependency breaking techniques that could be used to break dependencies to get tests in place.
Bringing existing code under tests is often a grey area in development processes. Many teams end up writing high-level black box tests or UI tests as a way around this without knowing that what prevents them from writing unit tests are dependencies. Most often, they abandon the task of writing tests in such situations considering the risk and effort involved in refactoring. A different approach is needed here.
The dependency techniques presented are "refactorings", with the difference that they are intended to be done without tests, with the aim of getting tests in place. Once you have your code under test, you could use any standard refactoring technique to improve the design, with the protection that the tests offer.
The techniques presented here have been used in a large eclipse project to bring several parts of the system under test and achieve the necessary code coverage which was otherwise impossible. The proven methods could be reused in any project facing similar situations.
Presenter: Nirmal Sasidharan [Robert Bosch GmbH]