Enhancing test data generation using constraint programming

Antonio Cortes, University of Texas at El Paso


Testing is an important approach to uncover errors in software systems; but, effective testing can be time-consuming, cumbersome, and error-prone when done manually. One way to improve this process is to automate the generation of test data. Random generation of test data is easy to implement; it does not need explicit information about what methods expect, i.e., preconditions; and it can find errors that could be difficult to detect by manually writing test cases. However, it could be hard to generate valid test data when ignoring preconditions. For example, random generation may require a lot of time to produce a test case for a method whose precondition requires integers in a small range. ^ This work presents the design, implementation, and evaluation of a prototype to boost the performance of random testing for Java classes annotated with the Java Modeling Language—a specification language designed to document the behavior of Java modules. The prototype is based on a tool that performs pure random testing. The prototype guides the generation of values for primitive parameters by translating preconditions into constraint solving problems. Then, a constraint solver is used to find appropriate values for the test data. Experimental evaluation shows that the prototype finds at least the same number of bugs as the original pure-random tool but in much less time. ^

Subject Area

Computer Science

Recommended Citation

Cortes, Antonio, "Enhancing test data generation using constraint programming" (2008). ETD Collection for University of Texas, El Paso. AAI1453811.