System’s Administrator’s Lab: Testing

Today, I got an email from the Fedora package manager, Red, who let me know that there was a problem with Petit. I don’t think he knew it, but it was actually my fault that the whole thing got screwed up, so I felt kind of bad. Well, to make a long story short, when I went to fix it, I realized I was most of the way through converting to Mercurial from Subversion and most of the way through converting my main library, Crunchtools, into a module in Python. Well, needless to say, I was now in a bind. I had broken pieces of all kinds of “what not” laying all around me. This is why I have added automated tests and tools like winpdb to my Systems Administrator Lab

This is where testing comes in. Thankfully, when I first created Petit, I also created a suite of functional tests. The testing is actually fairly simple. It iterates a list of command line options passing each combination that I specify and records the output to a file. It then compares the output just received to the output of a known good state. If output changes, you can compare and figure out if you really wanted that to happen.

Well, so here is what happened to me. I ended up having to push forward and fix three bugs to get Petit working again. I iterated between which test failed and using Winpdb to fix the bugs and was able to fix bugs that never would have been caught without functional testing. I saved myself a lot of stress and time too. If you are interested, check the simple but effective tests, I added to petit under the /test directory. So, when you are working in your lab, add testing to your tool belt.

Leave a Reply

Your email address will not be published. Required fields are marked *