Yesterday, I was introduced to the concept of test-driven development (TDD). I’m fairly sure that I had heard of it before and probably thought it was a good idea, but I really didn’t comprehend how important it was until yesterday. I had written tests before in Python once upon a time a couple summers ago when there was a research project related to lamprey and trees and nodes. My C++ class had us write up tests at the end of writing our program to test if it actually did what we thought it did. Nothing was driven by tests though.
Yesterday, I was writing Java unit tests. There were so many things that I realized that I couldn’t test when I first set up my program. It was somewhat neat to rearrange things such that I could test different things to ensure that they were working correctly. A fun, fun programming puzzle! Unit testing is actually ridiculously easy to implement when using Eclipse. They just have everything perfectly set up for you, and there a ton of really nice and easy tutorials. Eclipse even sets it up such that you tell it which class you want to make the unit test for and they give you a shiny template that includes everything so you don’t forget to test any function or whatever.
Today, I get to learn more about TDD. I’m a wee bit ridiculously excited.