In this series, I plan to advocate and explore the use of unit testing. This is a curriculum I develop during my free time.
Sep 26, 2007: Unit Testing, the Secret Weapon Behind a Great Company (slides)
Abstract: I was a Software Engineering in Test intern at Google this summer. One idea that they particularly emphasized early on in the internship is the importance of unit testing. I began to appreciate it through working on someone else's code and writing new code with unit tests. I came to realize its effectiveness in putting certainty into code, ultimately leading to stability of code quality and speed-up in development time. I would like to share with you some ideas for writing unit tests that you could find useful for your own projects.
TBA, 2008: Test-Driven Development
Abstract: Before I ask you to write unit tests, I want to ask you to do it the other way around. I'll give you the interface and unit tests of a Java class that is not yet written, and you are going to implement it in a way that passes the unit tests. In doing this, you'll learn how to read the unit tests, and later hopefully will be able to write some of your own.
I may be able to provide the exercise in another language other than Java. It will be considered upon request.
See the programming assignments of CS112 Summer II 2009 TF for a demonstration on unit testing of data structures in Java. Early programming assignments provide the unit tests. Later on, students are asked to supplement some of the unit tests.