Friday, November 14, 2008

The Clean Code Talks - Unit Testing

Misko Hevery made a presentation at Google Tech Talks about unit testing. He tells us that “There is no secret to writing tests… … there are only secrets to writing testable code!”. He describes the different category of tests and shows the importance of unit testing. He describes how to avoid writing untestable code.

And what I think the most important take away for me was that he recommended avoiding putting your object creation code and your business logic code together. This is so that you can make use of Dependency Injection to "inject" test data, stubs into the test.

A great presentation for people who are new to unit testing and how to make your code more testable.

[youtube=http://www.youtube.com/watch?v=wEhu57pih5w&hl=en&fs=1]

Slides of the talk

Google Testing Blog page

No comments:

Post a Comment