节点文献
基于方法消息路径的面向对象软件自动化集成测试方法研究
MM-Path Based Automated Integration Testing for Object-Oriented Software
【作者】 何伟;
【作者基本信息】 北京化工大学 , 控制理论与控制工程, 2013, 博士
【摘要】 软件控制论旨在探讨软件工程与控制科学的交叉应用。以软件控制论为指导,可以将控制理论应用于软件工程领域,以软件过程作为被控对象,通过分析和优化软件过程中的反馈机理,达到改进软件过程、提高软件质量的目的。集成测试是指将多个软件模块按照软件规格说明的要求组装为一个完整系统时进行的测试,重点检查各模块间的交互是否正确。面向对象软件开发技术的迅速发展提高了软件的可重用性和可维护性,但也给软件的集成测试带来了新的挑战。方法消息路径是由消息连接起来的方法执行序列,可以很好地体现面向对象软件中模块之间通过消息传递机制实现方法调用的交互过程。因此,深入研究基于方法消息路径的面向对象软件集成测试方法对于提高面向对象软件的质量具有重要的理论和应用价值。本文从软件控制论角度着手,将面向对象软件的集成测试过程视为被控对象,探讨如何针对方法消息路径利用优化技术实现面向对象软件的自动化集成测试。研究重点围绕方法消息路径的自动生成、方法消息路径生成中搜索空间的约简、基于方法消息路径的集成测试用例自动生成以及集成测试用例自动再生成等关键技术展开,以提高面向对象软件集成测试的有效性。主要研究内容及成果归纳如下:1、结合现有程序分析技术探讨了一种基于调用图的方法消息路径自动生成方法,并针对类层次分析和安德森指向分析这两种典型调用图构建算法就方法消息路径的生成效率进行比较,结果表明采用安德森指向分析较类层次分析算法可以更有效地实现方法消息路径自动生成,为后续基于方法消息路径的集成测试用例自动生成研究奠定了技术基础。2、对于复杂的面向对象软件,利用程序分析技术生成方法消息路径时,搜索空间会急剧膨胀,导致方法消息路径生成效率下降。为此,本文设计并实现了两种搜索空间约简策略,通过约简面向对象软件外部类库代码对应的调用图节点以及约简异常处理代码对应的控制流图节点,以减小方法消息路径生成的搜索空间。实验结果表明这两种搜索空间约简策略是确实可行的。3、考虑到面向对象软件的多继承类系和非公有方法给集成测试用例自动生成带来的巨大挑战,本文提出一种演化算法与强化学习机制相结合的测试用例自动生成方法。通过强化学习机制执行同构替换操作并计算相应操作的累计效益,指导演化算法搜索满足测试覆盖目标的集成测试用例。实验结果表明采用该方法能够有效地为面向对象软件生成集成测试用例。4、对于已有测试用例库的面向对象软件,为利用现有测试用例提供的大量方法调用信息,指导测试用例的自动生成,提高测试生成的有效性和可读性。本文提出了一种基于序列模式挖掘技术的测试用例自动再生成策略。该策略通过挖掘测试用例库获取常用的方法调用子序列——序列模式,并以所得序列模式为基础构建新的集成测试用例。实验结果表明采用该策略能够生成有效且可读性良好的集成测试用例。5、监视控制与数据采集系统广泛应用于航空航天、化工冶炼、核能发电、武器装备等关键领域。将本文提出的基于方法消息路径的面向对象软件自动化集成测试方法应用于openSCADA监视控制与数据采集软件的集成测试中,结果表明采用该方法能够有效地生成其方法消息路径;以方法消息路径为测试覆盖目标,能够有效地生成集成测试用例,实现openSCADA监视控制与数据采集软件的集成测试。
【Abstract】 Software cybernetics aims to explore the interplay between software engineering and cybernetics. According to the basic idea of software cybernetics, control theory can be applied to software engineering. More specifically, taking the software process as a controlled object, the feedback of the software process can be analyzed and optimized in order to improve the software process and product quality.Integration testing is performed when several modules are assembled into a system according to the requirement. It focuses on inspecting the interactions among the modules. The progress in Object-Oriented (00) development greatly improves the reusability and maintainability of software, but it also brings new challenges to the integration testing of00software. Method/Message Path (MM-Path) is defined as an interleaved sequence of method executions linked by messages. It is suitable to represent the interactions among the modules of00software. Therefore, it is meaningful in theory and application to investigate MM-Path based automated integration testing for00software.Following the idea of software cybernetics, the process of integration testing for OO software is regarded as a controlled object, and thereby realizing MM-Path based automated integration testing for OO software with the help of advanced optimization techniques. The key issues include automated MM-Path generation, search space reduction in automated MM-Path generation, MM-Path based automated test case generation and automated test case regeneration. In general, the main contents and results of this thesis can be summarized as follows:1. This thesis presents a program-analysis based approach to generate MM-Paths automatically. The approach is evaluated by two typical call graph construction algorithms, class hierarchy analysis and Anderson’s points-to analysis, on multiple benchmark programs. Empirical results show that the approach is practicable. Besides, based on Anderson’s points-to analysis, MM-Paths can be generated more effectively than based on class hierarchy analysis. It provides a solid foundation for the research on MM-Path based automated integration test generation.2. For large OO software, the search space in program-analysis based automated MM-Path generation may bloat and severely decrease the efficiency of MM-Path generation. Therefore, two search space reduction strategies are developed to reduce external libraries and exception handlings in automated MM-Path generation, respectively. Empirical results show that these search space reduction strategies are practicable.3. Considering the challenges brought by Inherited Class Hierarchies (ICH) and Non-Public Methods (NPM) of OO software, this thesis proposes an approach to generate integration test cases via combining evolutionary algorithms with reinforcement learning mechanism. For OO software with ICH and NPM, two kinds of isomorphous substitution actions are presented and Q-learning is employed to direct the evolutionary search of integration test cases. Empirical results show that using this approach can effectively generate test cases for OO software.4. For OO software with test repositories, the method invocations of already created test cases can be utilized to direct automated test generation. Thus, this thesis presents a strategy to regenerate integration test cases via mining test repositories. More specifically, sequential pattern mining is employed to obtain frequently-used subsequences of method invocations as sequential patterns from corresponding test repository, and then new test cases are derived on the basis of the sequential patterns. Empirical results show that this strategy can help to produce new integration test cases with good readability.5. Supervisory Control And Data Acquisition (SCADA) systems are widely used in critical areas such as space flight, chemical engineering, nuclear power and weapon manufacture. This thesis applies MM-Path based automated integration testing on inspecting openSCADA toolkit. The results show that taking the MM-Paths of openSCADA as test targets, integration test cases can be effectively generated to test openSCADA.