next up previous
Next: Testing C modules Up: Teaching and Testing Previous: Teaching and Testing

Introduction

Few Software Engineering courses today give serious attention to testing; even fewer provide significant hands-on testing experience. While many courses include programming exercises, the student solutions are rarely tested thoroughly. The testing is typically manual and there are simply too many solutions to run more than a few test cases each.

We have developed a novel approach to incorporating testing in many aspects of teaching that makes both teachers and students more effective. We teach a highly automated approach to testing with test programs that generate hundreds or thousands of cases, capture the program output, and check the output for correctness. This approach is hands-on and tool-based. Right from the start the students work with test tools and executable test scripts.

In our undergraduate Software Engineering courses, we focus on fundamental testing principles including: specification-based and program-based testing, for normal and exceptional inputs; structural coverage; module, integration, and system testing; top-down and bottom-up testing using stubs and drivers; and test documentation. These principles are illustrated on programs written in C, using UNIX tools such as tcov and diff, and PGMGEN [,], a test driver generator developed by the authors.

In our graduate Software Engineering course, we emphasize state-of-the-art techniques including state-based testing, automated test oracles, and test techniques for inheritance, exceptions, and templates. These techniques are illustrated on test suites for C++ class libraries using ClassBench, a class-testing framework developed by the authors [,,].

The instructor who teaches automated testing has a superb opportunity for using automated testing in grading, especially in courses with large enrollments. To reduce grading time, our test scripts are fully automated; a single command runs all test cases on all programs submitted. As a result, our graders are free to focus on code style, algorithm choice, and documentation. Even more important, automated testing is extremely effective in reinforcing Software Engineering principles. Of particular importance are implementation to specification, systematic verification, and component-based development, standard practice in other branches of engineering. Automated test suites are ideal for impressing students with the need to read and adhere to specifications. Thorough test suites show how testing can be used systematically to expose an implementation that does not meet its specification. Test suites for individual components focus attention on the components and their interfaces, independently of the system in which they will be used.



next up previous
Next: Testing C modules Up: Teaching and Testing Previous: Teaching and Testing



Peter Walsh
Thu Jan 18 13:59:59 PST 1996