Unit Test to the Rescue

I inherited a subsystem to maintain. Made some changes for the next major release. This code is a pain to test. You have to have very specific data to excite all the cases. At first I was manually updating data using SQL commands. However I found it way too tedious.

Luckily I decided to put a bunch of code into a database package that generates test data at will. I spent a lot of time creating that test data generation code. Then I had to debug the test generation code. However now I am benefiting big time.

I had to do a last minute move of some setup data from one script to another. Then I was able to generate unit test data with one call to a stored procedure. Check. Later I removed a bunch of debug code from the main database package. Does the code still work? I used the test generation code to set up some more test data in about a minute. We are good. Now before moving on to the next job, I am going to make this unit test generation program even more flexible. Good stuff.