首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 231 毫秒
1.
基于状态模式的面向对象的类测试技术研究   总被引:1,自引:0,他引:1       下载免费PDF全文
类的状态测试是面向对象软件测试的重要内容,类的单元测试归结为测试类的数据成员和成员函数。该文提出了基于类的状态模式测试用例生成方法,从类的状态常量、状态变量以及成员函数等方面测试类的一致性与完整性,指出只有满足类的状态常量的约束条件与状态变量的前置条件和后置条件的测试数据,才能充分检验类的状态模式中存在的不一致、不完整性错误。  相似文献   

2.
为实现白盒测试的源文件信息提取,提出了通过Lex和Yacc对使用上下文无关文法定义的语言进行词法和语法分析,构建独立的信息提取模块的思想。在函数信息提取部分提出了块和级的概念,用语句结构和语句链表结构将函数定义信息表示出来。在类信息提取部分通过识别出类声明中的成员变量和成员函数的声明信息,建立成员链表结构;识别类声明信息,建立类结构。然后将这些结构信息存入数据库,以供后续模块使用,充分做到了模块独立性和可重用性。这样只需要设计不同的信息提取模块,就可以将目前已经实现的面向C/C++语言的软件测试工具WBoxTool推广应用到其它面向上下文无关文法的语言。  相似文献   

3.
俞明 《软件》2013,(1):47-49
类构成面向对象程序设计的基础,当创建一个有意义的对象时需要对成员进行初始化操作,对于不同的情况应使用不同的方法来实现。类的成员可以被声明为公有、私有或保护,需有不同的访问方式。  相似文献   

4.
在编程工作中常会遇到在一个"类"中通过函数指针调用成员函数的要求,如,当在一个类中使用了C 标准库中的排序函数qsort时,因qsort参数需要一个"比较函数"指针,如果这个"类"使用某个成员函数作"比较函数",就需要将这个成员函数的指针传给qsort供其调用.本文所讨论的用指针调用"类"的成员函数包括以下三种情况:  相似文献   

5.
对VC++编程中如何访问MFC框架下各类的成员函数进行详细介绍,包括基于Doe/Viewarchitecture和Di—alogbased结构。给出Doe/View下访问应用程序类、框架类、文档类、视类的快速方法,对基于Dialog下如何访问对话框类成员函数进行了详细阐述。介绍了回调函数中访问类成员函数的方法。  相似文献   

6.
给出了一种应用于分析C 程序的类切片算法。对于一个给定的C 程序及其继承关系,应用此算法可以除去与程序执行无关的数据成员、成员函数、类及继承关系,从而对大而复杂的面向对象软件的调试、测试、分析、理解和修改过程提供了一种切实可行的方法。  相似文献   

7.
本文讲述了在VisualC 6.0环境下,类的定义的三种方法,并且讲述了在类的外部实现类的成员函数时要注意的问题:包括派生类的构造函数中的初始化表,带缺省参数的成员函数、虚拟成员函数等。  相似文献   

8.
本文讲述了在Visual C++6.0环境下,类的定义的三种方法,并且讲述了在类的外部实现类的成员函数时要注意的问题:包括派生类的构造函数中的初始化表,带缺省参数的成员函数、虚拟成员函数等。  相似文献   

9.
通过类的数据流分析计算出实例变量的“定义-使用”对信息以及成员函数的前置和后置条件,利用类的继承多态性对被测试类进行预处理。在JPF中设置搜索环境,将测试用例生成问题简化成模型检测中寻找反例的问题,提出一种在多核计算机上实现的线程级并行生成类测试用例的方法。实验结果表明,该方法可以减少测试生成所需的状态数和运行时间,算法可使用的处理核心越多、测试生成所需的时间越少。  相似文献   

10.
给出了一种分析C++程序的切片算法。对于一个给定的C++程序,应用此算法可以除去与程序执行无关的数据成员,成员函数、类及继承关系,从而为大而复杂的面向对象软件的调试、测试、分析、理解和修改过程提供了一种切实可行的方法。  相似文献   

11.
本文把类的操作划分成三个不同的级别,采用增量算法分别对不同级别的操作进行数据流分析,相应得到三种不同的定义-引用对,根据生成的定义-引用对就可以进行基于数据流的测试,如何对有调用关系的操作之间进行快速有效的数据流分析是对类进行数据流分析的一个难点,本文对该问题进行了深入研究,并提出了相应的解决方法。  相似文献   

12.
In object‐oriented terms, one of the goals of integration testing is to ensure that messages from objects in one class or component are sent and received in the proper order and have the intended effect on the state of the objects that receive the messages. This research extends an existing single‐class testing technique to integration testing of multiple classes. The single‐class technique models the behaviour of a single class as a finite state machine, transforms the representation into a data flow graph that explicitly identifies the definitions and uses of each state variable of the class, and then applies conventional data flow testing to produce test case specifications that can be used to test the class. This paper extends those ideas to inter‐class testing by developing flow graphs, finding paths between pairs of definitions and uses, detecting some infeasible paths and automatically generating tests for an arbitrary number of classes and components. It introduces flexible representations for message sending and receiving among objects and allows concurrency among any or all classes and components. Data flow graphs are stored in a relational database and database queries are used to gather def‐use information. This approach is conceptually simple, mathematically precise, quite powerful and general enough to be used for traditional data flow analysis. This testing approach relies on finite state machines, database modelling and processing techniques and algorithms for analysis and traversal of directed graphs. The paper presents empirical results of the approach applied to an automotive system. This work was prepared by U.S. Government employees as part of their official duties and is, therefore, a work of the U.S. Government and not subject to copyright. Published in 2006 by John Wiley & Sons, Ltd.  相似文献   

13.
A commonly used approach for detecting defects in a program is to generate a suite of test inputs which exercises the entire program under a given testing criterion. Current techniques to generate test cases automatically that satisfy a testing criterion choose test input data by considering the testing requirements in an arbitrary order. In this paper, a technique is presented that groups the requirements and orders the generation of the test cases to reduce the number of test cases generated. The grouping is based on the statically determined property of post-dominance. Test cases for each group are generated taking into account requirements for other groups. The use of this technique to generate test cases can be expected to produce fewer test cases that have to be retained with the software. A smaller number of test cases will require less effort and resources to test the software. The technique is especially useful in the maintenance environment, whether retesting of a changed program is done exhaustively or incrementally. The technique not only attempts to minimize the number of test cases generated but also reduces the effort to generate the test cases using the concept of a program slice.  相似文献   

14.
董文莉  胡建华 《软件学报》2009,20(8):2102-2112
随着Web Service组合变得越来越复杂,通过测试来保证服务质量和可靠性也变得越来越重要.将传统数据流分析方法扩展用于Web Service组合测试,提出了一种基于BPEL的Web Service组合的数据流分析测试方法.该方法基于一个测试模型:Web Service组合测试模型WSCTM,该测试模型可以捕获Web Service组合的数据流接口.采用基于服务的模型WSCTM,数据流可以从3个视点来分析:服务间、服务内和服务实现构件间.从而,Web Service组合的数据流测试可以在三层上得到实现.基于以上方法,可得到Web Service组合的定义-使用链,最终可产生满足既定测试标准以获得需求Web服务组合质量要求的测试路径.  相似文献   

15.
一种结构测试数据自动生成的框架   总被引:1,自引:0,他引:1       下载免费PDF全文
针对结构测试中控制流和数据流覆盖测试数据的生成都可以归结为面向路径的测试数据生成的问题,提出了一个通用的基于控制流和数据流的结构测试数据自动生成的框架。该框架根据控制流和数据流测试中所采用的覆盖标准优化选取测试路径,并以改进后的迭代松弛法为核心,对所选取的路径生成测试数据。以基于路径覆盖、分支覆盖和数据流覆盖测试数据自动生成这3种算法为核心,开发了一个测试数据自动生成的框架原型。实验结果表明该框架是可行的。  相似文献   

16.
Error flow analysis and testing techniques focus on the introduction of errors through code faults into data states of an executing program, and their subsequent cancellation or propagation to output. The goals and limitations of several error flow techniques are discussed, including mutation analysis, fault-based testing, PIE analysis, and dynamic impact analysis. The attributes desired of a good error flow technique are proposed, and a model called dynamic error flow analysis (DEFA) is described that embodies many of these attributes. A testing strategy is proposed that uses DEFA information to select an optimal set of test paths and to quantify the results of successful testing. An experiment is presented that illustrates this testing strategy. In this experiment, the proposed testing strategy outperforms mutation testing in catching arbitrary data state errors.  相似文献   

17.
面向对象类簇级测试中控制依赖分析方法研究   总被引:3,自引:0,他引:3  
类簇控制依赖信息是进行类间数据流测试的基础。本文通过克服已有类控制流分析的不足之处,提出了CCFG算法,依照类间测试序,通过分析继承、聚集和关联等类间关系特 征进而增量式地构造类间控制流图(ICCFG算法),并初步探讨了动态控制依赖分析方法。实验表明,上述控制流分析方法可方便地用于类间数据流测试,并能有效地探测定义一使用错误。  相似文献   

18.
19.
针对类状态测试可能遗漏数据错误问题,利用数据流分析技术对生成的测试序列进行分析,找出数据流异常进而对其改进,能较好地解决数据错误问题。为解决在状态测试执行时需要插装代码来跟踪状态转换以便进行可行性检测分析,以及需要通过改写被测类代码来解决类封装性限制进行类状态验证,导致测试脚本臃肿、强聚合和被测类代码版本不一致问题,提出了一种基于AOP类状态测试执行方法,它通过分离关注点、突破类封装性限制,能有效地解决这些问题。基于上述技术和方法,提出一种类状态测试模型,实例分析和实验结果表明,该模型能较好地实现类状态测试。  相似文献   

20.
This paper describes a new approach to performing data flow testing in the presence of aliasing, and a tool based on this method. The technique is based on the observation that, under certain reasonable assumptions, one can statically determine which variables are aliased whenever control reaches a given program point via a particular path. Furthermore, one can group together paths that behave similarly with respect to aliasing and represent them by regular expressions. The resulting test requirements demand that the test data execute representatives of particular sets of paths between variable definitions and uses. Copyright © 1999 John Wiley & Sons, Ltd.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号