Computer Programming Principles/Maintaining/Testing
Software testing is used to gain valuable information about a program's quality and can be used to uncover problems. Software testing is only as good at the conditions tested for. Untested conditions can still cause a program to function in unexpected ways. Knowing what requirements and priorities the program has is a major step in preparation for software testing. Software testing can help you find answers to:
- Are the requirements for the program satisfied?
- Are there any gaps in the program's requirements?
- Are there defects or failures in the program's designed?
- Are there any unexpected errors?
- Does the program work as expected?
Try to set up "one-button testing". That makes it much more convenient to type a little, then hit that button which
- saves the file you just edited,
- compiles the application with all the appropriate options (such as "-fno-emit-frame", if necessary), and
- runs a few quick tests, to make sure your "improvements" don't accidentally break something else.
Spending an hour to code up a few tests and set up one-button testing may *seem* like it is more hassle than it is worth. Manually compiling the file, and manually run through the various parts of the application to make sure they work, may take far less than an hour. But trust me, most programs you are going to edit-compile-test many, many times. And a year from now, when you make just one tiny little change, wouldn't you much rather push-the-button and be done with it, rather than
- manually compile the file
- manually run through the application and see that it suddenly it doesn't work any more
- pull out your hair until
- hours later, you remember you needed to include "-fno-emit-frame"
- manually re-compile the file, this time with "-fno-emit-frame"
- start testing all over from the beginning.
There are lots of ways to set up an automated build system.
One-button testing is just one part of the continuous integration recommended by some programmers.
Even lawyers can see the advantages of automated build scripts.