首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到17条相似文献,搜索用时 875 毫秒
1.
基于选择性冗余思想,提出了一种测试数据自动生成算法.算法首先利用分支函数线性逼近和极小化方法,找出程序中所有可行路径,同时对部分可行路径自动生成适合的初始测试数据集;当利用分支函数线性逼近和极小化方法无法得到正确的测试数据时,基于使得测试数据集最小的原理和选择性冗余思想,针对未被初始测试数据集覆盖的谓词和子路径进行测试数据的增补.由于新算法结合谓词切片和DUC表达式,可以从源端判断子路径是否可行,因此能有效地降低不可行路径对算法性能的影响.算法分析和实验结果表明,该算法有效地减少了测试数据数量,提高了测试性能.  相似文献   

2.
陈继锋 《计算机科学》2008,35(7):274-276
提出了一种新的带数组和循环的路径测试数据自动生成的方法.该方法只考虑数组中与路径中谓词函数有关的数组元素,将循环中的同一变量名在每一次执行时用不同的变量参数来替代,从而较好地解决了路径中数组循环有效处理的问题.为有效、简单地自动生成测试数据,建立了谓词函数关于输入变量的线性约束系统.当谓词函数为线性表达式时,不需要计算其线性算术表示,仅计算非线性函数谓词函数的线性算术表示,且不需计算路径中的谓词片和确定输入依赖集,以及构造谓词函数关于输入变量增量的线性约束系统.理论分析和实例验证该方法具有简单、直观、有效且计算量小等特点.  相似文献   

3.
软件测试是保证软件可靠性的一个重要手段.面向路径测试是软件测试中一种重要方法.提出了一种分支函数线性逼近的测试数据自动生成算法.结合赵瑞莲给出的谓词切片算法和程序DUC表达方式以及本文提出的算法,给出了一个基于程序执行的路径测试及测试数据自动生成新算法.由于算法采用DUC表达式,不仅可以从源端判断子路径是否可行,而且有效地降低了不可行路径对算法性能的影响.另外,与现有文献中单纯利用分支函数极小化方法的算法相比,新算法由于有机结合了分支函数线性逼近和极小化方法的长处,因此减少了测试用例的数量,提高了测试效率.  相似文献   

4.
基于谓词切片的字符串测试数据自动生成   总被引:3,自引:0,他引:3  
字符串谓词使用相当普遍,如何实现字符串测试数据的自动生成是一个有待解决的问题,针对字符串谓词,讨论了路径Path上给定谓词的谓词切片的动态生成算法,以及基于谓词切片的字符串测试数据自动生成方法,并给出了字符串间距离的定义,利用程序DUC(Definithon-Use-Control)表达式,构造谓词的谓词切片,对任意的输入,通过执行谓词切片,获取谓词中变量的当前值,进而对谓词中变量的每一字符进行分支函数极小化,动态生成给定字符串谓词边界的ON-OFF测试点,实验表明,该方法是行之有效的。  相似文献   

5.
设计了一个通用的基于控制流和数据流的结构测试数据自动生成的工具。该工具根据控制流和数据流测试中所采用的覆盖标准来选取测试路径,并以改进后的迭代松弛法为核心,对所选取的路径生成测试数据。同时工具采用Fibonacci法优化选取路径,对不可达路径进行处理,并对测试数据的分支覆盖率、DCP覆盖率等进行了统计。实验结果表明该工具是可行的。  相似文献   

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

7.
对于大型软件来说,程序中不可达路径的存在增加了软件测试的耗费并严重影响了测试的准确性。通过在已生成的基本路径集中排除不可达路径的影响,有利于结构测试中各阶段的实现。提出了一种利用数据流分析信息检测不可达路径的方法。通过对条件分支相关性的探测进而确定了程序中的不可达路径,并通过适当地选取条件谓词,提高了检测分支的覆盖率。  相似文献   

8.
面向方面程序设计是面向对象程序设计技术的补充和完善,高效的面向方面程序测试方法是面向方面程序的质量保证.提出一个基于谓词动态切片技术的测试方法.首先,构造完整的AOP语句控制流图,它包含AOP的方面、切入点、连接点、建议等因素.然后,根据完整的AOP语句控制流图生成所有路径,针对每条路径,构造其分支函数,计算得到相应的测试数据,若路径不可执行,则不再计算其测试数据.在这个过程中,通过构建简化动态依赖图来生成谓词动态切片,再用谓词动态切片来帮助调整测试数据.最后,将各路径的实际输出数据与期望输出数据相比较,即可判断该程序是否有错误.经实例分析和实验验证,此方法可以系统地测试一个完整的面向方面程序,提高了测试数据的生成效率,并产生有效的测试用例.  相似文献   

9.
为了提高测试数据自动生成的效率,提出基于改进遗传算法的多路径测试数据生成方法.首先将定向变异算子引入遗传算法,根据当前最优解产生变异个体,使变异向有利的方向进行,在保持种群多样性的同时提高局部搜索能力;然后综合考虑执行路径与目标路径间的路径相似程度以及谓词分支距离,设计了个体适应度评价函数,以有效地区分个体的优劣程度.针对基准程序进行实验,验证了该方法相对于传统方法的优越性.  相似文献   

10.
以程序结构测试自动生成为研究背景,提出了一种重叠路径结构用以描述程序路径,并以此为基础设计了一种多路径测试数据生成适应值算法,实现了一次搜索完成多条路径的测试数据生成。算法通过目标路径间共享遗传算法产生的中间个体减少单一路径搜索始于随机产生的无序个体的初期迭代,从而加快搜索收敛的速度。应用于常用的基准程序和取自实际项目的程序,该算法与典型的分支谓词距离算法相比平均消耗时间缩短了70.6%。  相似文献   

11.
Test data generation in program testing is the process of identifying a set of test data which satisfies a given testing criterion. Existing pathwise test data generators proceed by selecting program paths that satisfy the selected criterion and then generating program inputs for these paths. One of the problems with this approach is that unfeasible paths are often selected; as a result, significant computational effort can be wasted in analysing those paths. In this paper, an approach to test data generation, referred to as a dynamic approach for test data generation, is presented. In this approach, the path selection stage is eliminated. Test data are derived based on the actual execution of the program under test and function minimization methods. The approach starts by executing a program for an arbitrary program input. During program execution for each executed branch, a search procedure decides whether the execution should continue through the current branch or an alternative branch should be taken. If an undesirable execution flow is observed at the current branch, then a real-valued function is associated with this branch, and function minimization search algorithms are used to locate values of input variables automatically, which will change the flow of execution at this branch.  相似文献   

12.
考虑程序中分支冲突和异常处理结构对控制流信息的影响,提出一种改进的程序可达基路径生成方法。分析不可达路径产生的原因及其判定方法,构建异常控制流图。在此基础上计算相关分支之间的关系,利用深度优先遍历方法得到程序的可达基路径集。实例分析结果表明,该方法能准确生成可达基路径集,满足基路径测试的要求。  相似文献   

13.
This paper describes a system that attempts to generate test data for programs written in ANSI Fortran. Given a path, the system symbolically executes the path and creates a set of constraints on the program's input variables. If the set of constraints is linear, linear programming techniques are employed to obtain a solution. A solution to the set of constraints is test data that will drive execution down the given path. If it can be determined that the set of constraints is inconsistent, then the given path is shown to be nonexecutable. To increase the chance of detecting some of the more common programming errors, artificial constraints are temporarily created that simulate error conditions and then an attempt is made to solve each augmented set of constraints. A symbolic representation of the program's output variables in terms of the program's input variables is also created. The symbolic representation is in a human readable form that facilitates error detection as well as being a possible aid in assertion generation and automatic program documentation.  相似文献   

14.
实际测试用例一般不能满足变异测试充分,但遗传算法搜索空间较大,可使用其生成变异测试充分度较高的测试用例集.适应值函数的构造使用分支函数插装法.首先根据杀死弱变异体的必要性条件,构造必要性条件分支函数,插装于源程序中;然后根据可达性条件,构造可达性条件的分支函数并插装.使用基于面向路径的遗传算法来搜索杀死弱变异体的测试用例.将终止条件改为程序最终结果的不同,插装函数不变,生成满足条件的强变异测试用例.对于多重弱变异,按熙可达路径实施等价类划分,每一个等价类采用与单重弱变异相同的方法.实验结果表明,遗传算法可生成杀死各类变异体的测试用例,优于随机生成的测试用例.  相似文献   

15.
Automated test data generation plays an important part in reducing the cost and increasing the reliability of software testing. However, a challenging problem in path-oriented test data generation is the existence of infeasible program paths, where considerable effort may be wasted in trying to generate input data to traverse the paths. In this paper, we propose a heuristics-based approach to infeasible path detection for dynamic test data generation. Our approach is based on the observation that many infeasible program paths exhibit some common properties. Through realizing these properties in execution traces collected during the test data generation process, infeasible paths can be detected early with high accuracy. Our experiments show that the proposed approach efficiently detects most of the infeasible paths with an average precision of 96.02% and a recall of 100% of all the cases.  相似文献   

16.
There has been significant interest in automating testing on the basis of an extended finite state machine (EFSM) model of the required behaviour of the implementation under test (IUT). Many test criteria require that certain parts of the EFSM are executed. For example, we may want to execute every transition of the EFSM. In order to find a test suite (set of input sequences) that achieves this we might first derive a set of paths through the EFSM that satisfy the criterion using, for example, algorithms from graph theory. We then attempt to produce input sequences that trigger these paths. Unfortunately, however, the EFSM might have infeasible paths and the problem of determining whether a path is feasible is generally undecidable. This paper describes an approach in which a fitness function is used to estimate how easy it is to find an input sequence to trigger a given path through an EFSM. Such a fitness function could be used in a search-based approach in which we search for a path with good fitness that achieves a test objective, such as executing a particular transition, and then search for an input sequence that triggers the path. If this second search fails then we search for another path with good fitness and repeat the process. We give a computationally inexpensive approach (fitness function) that estimates the feasibility of a path. In order to evaluate this fitness function we compared the fitness of a path with the ease with which an input sequence can be produced using search to trigger the path and we used random sampling in order to estimate this. The empirical evidence suggests that a reasonably good correlation (0.72 and 0.62) exists between the fitness of a path, produced using the proposed fitness function, and an estimate of the ease with which we can randomly generate an input sequence to trigger the path.  相似文献   

17.
Test data generation is always a key task in the field of software testing. In recent years, meta-heuristic search techniques have been considered as an effective way to assist test data generation in software structural testing. In this way, some representative test cases with high-coverage capability can be picked out from program input space. Harmony search (HS) is a recently developed algorithm and has been vigorously applied to various optimization problems. In the paper, we attempt to apply harmony search algorithm to generate test data satisfying branch coverage. At the preprocessing stage, the probes used for gathering coverage information are inserted into all branches via program static analysis. At the same time, the encoding and decoding styles between a test case and a harmony are also determined in advance. At the stage of test data searching, the subset of test data that has much stronger covering ability is stored in harmony memory. During the evolution process, one part of test suite is selected and adjusted from the harmony memory, and the other part is randomly generated from input space. Once a test suite is yielded after one-round search, its coverage can be measured by fitness function in our search algorithm. In our work, a new fitness function for branch coverage is constructed by comprehensively considering branch distance and branch weight. Here, the branch weight is determined by branch information in program, that is, the nesting level of a specific branch and the predicate types in it. Subsequently, the computed coverage metric is used for updating the test suite in the next round of searching. In order to validate the effectiveness of our proposed method, eight well-known programs are used for experimental evaluation. Experimental results show that the coverage of HS-based method is usually higher than those of other search algorithms, such as simulated annealing (SA) and genetic algorithm (GA). Meanwhile, HS demonstrates greater stability than SA and GA when varying the population size or performing repeated trials. That is to say, music-inspired HS algorithm is more suitable to generate test data for branch coverage in software structural testing.  相似文献   

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

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