For those of you who are completely unaware of what unit testing is here is a brief description.
In computer programming, unit testing is a method of testing that verifies the individual units of source code are working properly. A unit is the smallest testable part of an application. In procedural programming a unit may be an individual program, function, procedure, etc., while in object-oriented programming, the smallest unit is a method, which may belong to a base/super class, abstract class or derived/child class.
Taken from wikipedia [http://en.wikipedia.org/wiki/Unit_testing]
I have been reading about unit testing a bit recently and trying to work out how I would use unit testing in my own code. Its really an interesting approach which I am frustrated I did not learn in school. Most of my truly useful programming knowledge has come outside of my school curriculum, which is unfortunate. What I like the most about unit testing is that it really allows me to change my algorithm for speed, efficiency, underlying data structure, etc and have some degree of confidence I didn’t break anything.
Any time you make a substantial change to your code there is always going to be the nagging sensation that you may have just royally messed something up. While unit testing doesn’t take the place of traditional testing it looks like it could significantly speed up making sure code is at least of moderate quality… it should improve code quality before it gets to testing and just help me sleep better.
For those of you who are familiar with unit testing you know that it is not without limitations. Unit tests are designed to be run by themselves which means you have to try and predict input and output. Unfortunately this is just not a reasonable expectation. As a result you will need to have real people test your code still.
That being said, I am going to try and work unit testing into my regular coding practices. I am hoping it will make for less sloppy code.




