| Use case is an important concept in requirement analysis and software design. It can drive the development of software through its whole life, and can facilitates to keep consistency and traceability of each stages. As most programming languages do not provide encapsulation mechanism for use case, the codes of a use case are often scattered in different modules, and the codes of different use cases are often tangled together. Thus, identifying use cases and their internal structures from source code facilitates the understanding of software, and can improve the software’s traceability.As far as we know, the researches on use case recovery are quite few, and are not very mature, and no researches identify the internal structure of a use case. Besides, existing static research approaches do not concern how to process the control flow of programs with GUI.This thesis proposes a novel approach to construct the control flow graph of program with graphical interfaces and event responses, which is called control flow graph with GUI. Control flow graph with GUI not only contains the explicit control flow transfer caused by control flow statements and method calls, but also contains the implicit control flow transfer triggered by events of graphical interface operations. This paper improves and implements the method of identifying use case structure(base flow and alternative flow) by purpose success statement and dominance relation, and presents a targeted method to deal with the situation that the intersection of forward component and backward component of base flow is not empty. In addition, this paper discusses the influence of the processing sequence of base flow and alternative flow of several use cases on the identification result, and concludes that it would be better to do alternative flow identification after base flows of all use case have been identified.Finally, based on Soot, an open source tool, a tool to recover use cases of Java GUI programs is designed and implemented, which is called UseCaseExtractor. We perform an experiment with the tool on an open source software which simulates an ATM system. The result shows that the tool can recover use cases and their internal structures with high precision and callback. |