Testing: It’s not just for QA anymore

When you hear the word “testing” in regards to software development, do you

   a) Groan and say “Oh no!”
   b) Exclaim “Testing? We don’t need no stinkin’ testing!”
   c) Say “Hey it works. It compiled!”
   d) Sarcastically exclaim “Great! Just what I need! More work!”
   e) Casually mention “We let our customers test it for us because they’re great at it!”
   f) All of the above
   g) None of the above
   πŸ˜€

All joking aside, testing is one of the most important things we can do as software developers. Too often, we defer testing until it’s too late. We kid ourselves into thinking that we will have the time later to test. But make no mistake, testing must be done at all stages of development. The earlier, the better.

Some methodologies like Extreme Programming even emphasize that tests are written before any code is actually written. No matter what your own personal philosophy is, testing cannot be ignored.

A project that I am currently working on, needed a method of testing the results of a series of long and complicated calculations. Having worked with JBuilder and JUnit and liking the results, we decided on using a Delphi port of JUnit, which is called DUnit. Like JUnit, DUnit is available under an open-source license.

Using DUnit, we were able to automate the very tedious task of verifying lots of constant values (stored in a database) as well as the caculations. Every time we made a change, we would re-run the test suites and see if the tests would pass. If they didn’t we would determine if the problem was in our code or the results that we were expecting and make the necessary changes. Needless to say, we are much more confident with the code that has now been very rigourously tested.

As you write code, think of ways that you can automate tests to verify your own code. It takes time and practice, but in the long run, it will return a big payoff with reliable and accurate results. I’ll leave you with a few final thoughs regarding testing:

   Testing: Just do it
   Test often
   Test early
   Automate when possible

This entry was posted in Commentary, Delphi, Software Development. Bookmark the permalink.