tg – a Test driver Generator for Ada programs

Testing software is usually not considered the most fun part of programming. For most it’s a chore, something that we do because we have to, not because we think it’s fun and exciting, so naturally if a tool claims to ease this pain, it’s worth taking a look at. tg is one such tool:

tg is a program that helps testing software. If you want to test a piece of software, that normally means you have to execute it over and over again, passing various sets of input data to it, and verifying that it gives the correct results for each input. You normally write a program that does all this automatically. Such a program is called a “test driver”.

tg can generate such test driver programs, given a very succinct description of the individual test cases. tg translates this description into a complete Ada program. If you compile this test driver, link it with the software you want to test, and execute it, it performs all the test cases and tells you whether the software under test behaved as expected or not.

Sounds good, yes? And it gets better when you read the documentation and see how simple it is to get going. Check out this small example or if you’re in the mood for some more reading, how about this larger example.

tg is written in Ada 95, and it should compile “out of the box” with the GNAT compiler. tg is the brainchild of André Spiegel.

Leave a Reply