节点文献
基于UML活动图的仿真与测试方法研究
Research on UML Activity Diagram-based Simulation and Testing Method
【作者】 俞磊;
【导师】 王林章;
【作者基本信息】 南京大学 , 计算机技术, 2014, 硕士
【摘要】 随着软件系统的规模和复杂性不断地增长,对软件质量保证技术形成了新的挑战。软件设计建模通过提高抽象层级控制软件系统的高复杂性问题。而随着模型驱动开发(Model Driven Development, MDD)在学术界和工业界获得了越来越多的关注,软件开发的关注点开始从以代码为中心到以模型为中心转变。统一建模语言(Unified Modeling Language, UML)是用于软件系统分析设计建模的事实标准,它提供了多种类型的模型图,从结构和行为等侧面对系统进行描述。UML模型作为系统的设计规约,会直接影响系统的实现质量,保证其正确性有利于降低整体的软件开发及维护成本。然而现有的方法多局限于人工审核,缺乏自动化检验的支持,效率低下。同时,代码按照模型的设计对系统进行实现,其行为是否满足模型的预期也是我们关注的重点。因此基于模型的仿真技术研究和自动测试技术研究成为一项迫切的需求,具有广泛的应用前景。论文研究基于模型的仿真方法,是受电子、机械等成熟工程领域产品仿真技术启发研究针对模型的自动检验方法,以确认模型是否符合预期,从而可以使我们在软件开发周期的早期更为容易地发现缺陷。另外,论文还研究了基于模型的自动测试技术,通过模型生成测试用例驱动待测程序执行,进而通过比较程序执行轨迹和模型的预期行为序列是否一致,达到自动测试的目的。论文的主要工作如下:(1)提出了面向仿真的UML活动图形式定义。还提出了基于活动图的精化与扩展方法、活动图建模缺陷类型以及仿真与测试充分度覆盖准则。(2)提出了基于符号执行的活动图仿真方法。该方法以活动图作为待测程序的动态行为模型,在活动图上采用深度优先遍历的策略对其符号执行,从而实现了对活动图的仿真执行。(3)提出了基于模型的混合执行测试方法。在对活动图进行混合执行的过程中,利用获取的有效信息,生成代码测试所需的具体测试用例,包括测试输入、期望输出、方法调用序列等,解决了循环和并发的情形带来的问题。借助混合执行的手段,通过预定义循环执行次数,防止循环导致的状态空间爆炸问题;通过集合等价的概念统一并发情形下的程序行为;测试用例生成后,我们使用生成的具体测试用例驱动插桩后的源程序执行,收集每个测试用例驱动的执行轨迹,然后与活动图上对应的执行路径做一致性检验,从而实现模型驱动的自动化测试。(4)基于上述的研究工作,我们开发了原型工具并进行了实例研究。实验表明,基于符号执行的活动图仿真方法能够动态地展示模型的逻辑行为并分析其操作语义,有效地找出系统在设计阶段呈现于活动图上的缺陷。同时,基于活动图的混合执行测试方法能够自动产生并执行具体测试用例,验证代码实现与模型的一致性。
【Abstract】 With the increasing of scale and complexity of software system, new challenges for software quality assurance technology formed. Software design modeling controls the high complexity of software system by raising the abstraction level. And with the Model Driven Development (the Model Driven Development, MDD) gaining more and more attention in academia and industry, software Development concerns shift from code-centric to model-centric. Unified Modeling Language (Unified Modeling Language, UML) is the de facto standard for modeling of design and analysis of software system. It provides several types of model diagrams, describes systems from the aspect of structure and behavior. As the system design specification, UML model will directly affect the quality of system implementation. To ensure its correctness is helpful to reduce the overall cost of software development and maintenance. However, existing approaches are limited to human review, lacking support of automation. This Paper mainly studies the model-based software simulation method. It is a mature technology in engineering fields such as electronics, machinery. Product simulation technology inspires our research on the automatic testing method for models to confirm whether the model in line with expectations, which can make us more easily found defects in the early stages of the software development cycle. So model-based simulation technology has become an urgent demand and it has broad application prospects.The main contribution of this paper is as follows:(1) We put forward the formal definition of the UML activity diagram for simulation. In order to solve the inconsistent of abstraction levels of models and the situation of incomplete models, we propose the method of refining and extension for activity diagram, defects of activity diagram and its classification and a sufficient degree of coverage criteria.(2) We propose the activity diagram simulation method based on symbolic execution. This method takes the activity diagram as the dynamic behavior model of the application under test, symbolically execute the activity diagram using depth-first traversal strategy, so as to realize the simulation of activity diagram.(3) We propose the model-based concolic testing method. In the process of simulation, we generate concrete test cases including testing input and expected output, method call sequence for white-box testing and this method solves the problem caused by circulation and concurrency. Through the predefined number of executions, prevent circulation leads to the state space explosion execution. Through the concept of set equivalent, we uniform program behavior under concurrent cases. After test case generation, we use the specific test cases to drive instrumented source program to execute, collect the running trace and then check consistency with the corresponding execution path in activity diagram, so as to realize the test automation.(4) Based on the above research work, we developed a prototype tool and a case study was carried out. Experiments show that the symbolic-based simulation method can effectively find the defects on activity diagram. And the concolic execution testing method on the activity diagram is able to automatically generate and execute the specific test cases and check the consistency between code implementation and model behavior.
【Key words】 model simulation; symbolic execution; model-based testing; concolic execution; UML activity diagram;