With the rapid development of software technology, programs become larger and more complex. During software development process, most programmers analyze and test programs manually. This is time consuming and cannot ensure good quality of software product. If there is a tool that can analyze program and generate test cases automatically, the reliability of software will be improved dramatically and considerable resources will be saved. For that purpose many tools have been developed. However, few of them can really generate test cases"automatically". Moreover, the variable types they can handle are quite limited.Most of the paths generated to satisfy path coverage are infeasible. Those infeasible paths not only take up a lot of resources, but also make the tool unpractical. We eliminate all the infeasible paths with a constraint solver. For a feasible path, values of input variables can be found such that the program is executed along that path.The main work of this thesis include:1.Implementation of tool PATPAT can deduce the predicates of a path automatically. By solving predicates the feasibility of a path can be decided and the input data making the program follow this path will be generated. This thesis also introduces two kinds of methods for dealing with fixed-size arrays, which is quite challenging.2.Implementation of tool EFATEFAT, which is based on extended finite state machines(EFSM), can automatically generate feasible paths and a suite of test cases under path coverage.PAT and EFAT accept several data types, such as integers, Booleans, floats, enumerates and fixed-size arrays. |