Join us on:

T28. How To Write Hard To Test Code & What To Look For When Reviewing Other Peoples Hard To Test Code

Misko Hevery, Google

Misko Hevery works as an Agile Coach at Google where he is responsible for coaching Googlers to maintain the high level of automated testing culture. This allows Google to do frequent releases of its web applications with consistent high quality. Previously he worked at Adobe, Sun Microsystems, Intel, and Xerox (to name a few), where he became an expert in building web applications in web related technologies such as Java, JavaScript, Flex and ActionScript. He is very involved in Open Source community and an author of several open source projects. Recently his interest in Test-Driven-Development turned into with which he hopes to change the testing culture of the open source community.

The ability to write hard to test code is innate in every developer form the moment we have built our first "Hello World" application. It is so automatic that we do not even know when we are doing it. On the other hand writing testable code requires that you un-learn this behavior. In this tutorial you will learn how to recognize the red flags in the code and what are the common solutions for them. We will look at sample code representing common development practices and look into subtleties why this code is hard to test and how to fix it. The goal of the tutorial is to arm you with knowledge of how to write code which can be tested using small focused tests.


Demonstrate common pitfalls of tightly coupled code which gets in the way of writing small focused tests.


Code snippets of problem. Try to write a unit tests for the code and point out all of the things preventing us from doing so. Finally show same functionality refactored and the ease with which the code can be tested.

Audience: Researchers, Practitioners, Educators
Please email any questions to . This e-mail address is being protected from spambots. You need JavaScript enabled to view it