| ![]() |
Combat: A Compiler Based Testing System1
Mary Jean Harrold
Department of Computer Science
Clemson University
Clemson, SC 29634-1906
Abstract
Since testing is a critical part of program development that requires considerable effort, tools that
automate the testing process are important and useful. In this paper, we describe our COMpiler BAsed
Tester, Combat, that is incorporated into the GNU C compiler. Combat provides unit testing of C procedures
using both control flow and data flow testing methods. Our tester handles arbitrary C programs;
for programs with more than one procedure, Combat tests the procedures one at a time. In addition to
the control flow and data flow testers, the Combat system includes tools to graphically view the procedure
under test and to automatically detect and eliminate redundant tests. The implementation of our
tester is efficient since we use existing analysis information routinely computed by a compiler to identify
the testing requirements. We argue that our tester executes faster than previously developed testers
since it uses dynamic data flow analysis to determine which testing requirements are satisfied by a test.
Furthermore, Combat can easily be modified to test programs written in other source languages, such as
FORTRAN and C++, that are translated into the same intermediate form. We are currently extending
Combat to provide interprocedural testing and to improve the user interface to the system.
Keywords: control flow testing, data flow analysis, data flow testing, testing tool.
1 Introduction
Since testing is a critical part of program development that requires considerable effort, tools that automate the testing process are important and useful. Data flow testing [5, 10, 14] is a program-based testing technique that uses the flow of data in a program to determine whether the program is adequately tested. Many existing data flow testers are source level testers [3, 4, 10] that translate the program under test to some intermediate form and perform data flow analysis to compute the required testing information. Such a tester unnecessarily duplicates much of the computation that is usually performed by a compiler. Moreover, the usefulness of the tester is limited to testing programs written in the source language for which it is developed. On the other hand, a compiler based tester [2, 6, 8, 12, 13] uses an existing compiler to translate the program to some intermediate form. Since the tester is dependent on the intermediate form of the program and not on the source language, the tester can take advantage of other compilers that translate different programming languages to the same intermediate form. Further, since the information required for data flow testing is quite similar to that required by compiler optimizations, a compiler based tester can reuse the data flow