Implementation of an Object-Oriented Test Data Generator

Krassimir Manev, Anton Zhelyazkov, Stanimir Boychev
The paper summarizes the experience gained from implementation of a test data generator for structured testing of a software system written in an object-oriented programming language. Test generator is based on the static analysis of the source code under testing. Among the different possible approaches for structured testing the path-oriented approach with constraints solving was chosen and among the different possible levels of testing-the testing of a set of modules (methods). The main
more » ... of implementing the test data generator are considered and for each of the stages some of the arising problems and the implemented solutions are described. INTRODUCTION Automated testing (AT) of software and automated test data generation (ATDG) are obligatory for contemporary software industry. However, they are significant for other domains too, for example, the education in programming. Checking of hundred programming assignments manually is extremely difficult. That is why some teachers use special purpose software-the so called grading systems-for automated checking of students programs [7]. The design and development of automated grading systems could be considered as a new, promising, sub domain of e-learning. Test data generation is an essential part of the grading process, which is still not entirely automated. As members of a team developing a system for smart object-oriented code analyzis and testing (SSA, [9]), we design and implement an ATDG tool, which could be used both for testing the projects of a software company and for checking students programs. Our experience gained through implementation of a selected approach is described below. Next we will use the terminology from [9]-a systematic review of the state of the art in the domain. The implemented tool has been designed and developed according to the requirements identified and described in [8]. Our ATDG tool is a part of a system for code analyzis. So, the structured (transparent box) testing is implemented, based on the static analysis of the software under testing. Among the different possible approaches for structured testing the path-oriented approach [12] with constraints solving [1] has been chosen. Traditional stages of ATDG for structured testing, summarized in [9] are the following (Fig.1): Program analysis. At this stage a control flow graph of the program (CFG) and a data dependence graphs (DDG) for each local variable are constructed; Paths selection. At this stage a set of paths is chosen so as to "cover" the CFG of the program [12], following the testing criteria "each edge at least once"; Generation of test data. At this stage a set (conjunction) of constraints is generated for each of the selected paths, corresponding to its branching conditions [1]. Then the satisfiability of each conjunction is checked by a SAT solver and if it is satisfied then an attempt is made to