Back

Unit Testing In 60 Seconds

In Git In 60 Seconds, I briefly touched on the idea of writing code that suddenly does not work, and then I used that example as a reason for using version control. I never mentioned unit testing, and I really feel like I should have.

Unit Testing is a great practice for simplifying the development of code. It seems strange to me that it gets a bad shake from many experienced developers though. I won't pretend to understand why many developers choose to write code without creating a small test that can quickly pass or fail the code they're writing, nevermind the fact that if you can write the test, you'll likely have a better understanding of the intent of the code before you ever start writing it, which gives you a good chance of only writing the code you need.

If you want to get a better idea of how to write unit tests, look up "The Art of Unit Testing" by Roy Osherove. You can find his website at http://artofunittesting.com.