首页 | 官方网站   微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 455 毫秒
1.
The aim of software testing is to find faults in a program under test, so generating test data that can expose the faults of a program is very important. To date, current studies on generating test data for path coverage do not perform well in detecting low probability faults on the covered path. The automatic generation of test data for both path coverage and fault detection using genetic algorithms is the focus of this study. To this end, the problem is first formulated as a bi-objective optimization problem with one constraint whose objectives are the number of faults detected in the traversed path and the risk level of these faults, and whose constraint is that the traversed path must be the target path. An evolutionary algorithmis employed to solve the formulatedmodel, and several types of fault detectionmethods are given. Finally, the proposed method is applied to several real-world programs, and compared with a random method and evolutionary optimization method in the following three aspects: the number of generations and the time consumption needed to generate desired test data, and the success rate of detecting faults. The experimental results confirm that the proposed method can effectively generate test data that not only traverse the target path but also detect faults lying in it.  相似文献   

2.
夏春艳  张岩  宋丽 《软件学报》2016,27(4):802-813
路径覆盖是软件测试领域重要的测试方法之一.为了提高路径覆盖测试效率,在采用遗传算法进化生成路径覆盖的测试数据过程中,利用被测程序条件语句的相关性判定不可达路径,除路径中必经节点外,其他节点在不可达路径中出现的概率越大,穿越该节点的个体就具有越高的穿越度,在进化过程中应得到保护.提出了根据个体的穿越度设计适应度函数方法,从而提高测试数据的生成效率.将所提方法应用于基准程序和工业用例,并与同类方法比较可知,该方法生成路径覆盖的测试数据具有较高的效率.  相似文献   

3.
杜莹  孙百才  巩敦卫  田甜  姚香娟 《软件学报》2022,33(9):3297-3311
路径测试是一种非常重要且应用广泛的结构测试方法, 已有路径生成方法的测试效率不高、测试开销较大, 且易生成冗余测试路径. 针对以上问题, 主要研究路径选择问题的优化模型及其进化求解方法, 目的在于: 在不降低测试覆盖率的前提下, 减少冗余路径的数量, 降低测试消耗. 首先, 以多条路径作为决策变量, 基于该决策变量包含的边数和路径数, 建立多目标优化模型; 然后, 采用多目标进化算法求解该模型, 得到目标路径集. 将所提方法应用于7个基准测试程序, 并与其他算法比较. 实验结果表明, 相比其他算法, 所提方法能够在保证测试充分性的条件下, 降低测试消耗, 从而提高测试效率.  相似文献   

4.
目前测试数据生成方法多数未考虑到面向对象软件的多态特性,无法运用生成的测试数据对程序的多态信息进行充分的测试。根据多态路径测试数据生成的要求,提出了一种应用模拟退火—粒子群优化(simulated annealing-particle swarm optimization,SA-PSO)混合算法在多态路径测试中生成测试数据的方法,并通过多态性实例对基本粒子群算法、遗传算法、PSO-GA(particle swarm optimization-genetic algorithm)和SA-PSO算法在相同条件  相似文献   

5.
数据流覆盖可有效地检测软件中的缺陷与错误.针对该覆盖准则中存在的插装监测开销庞大和测试数据生成效率不高的问题,提出一种新的基于定值-引用对覆盖的测试数据进化生成方法.该方法主要分为两部分,首先,通过约减测试目标来减少插装开销,提出的包含关系算法可找到一个定值—引用对子集,使得覆盖该子集就能保证所有测试目标被覆盖;然后,采用遗传算法为所有测试目标生成测试数据,设计的适应度函数综合考虑个体实际执行的路径与每个测试目标的定义明确路径的匹配程度.将该方法用于8个基准程序的测试数据生成,并与其他方法比较,结果显示其可有效提高程序覆盖率和测试数据生成效率.  相似文献   

6.
Generating test data that can expose the faults of the program is an important issue in software testing. Although previous methods of covering path can generate test data to traverse target path, the test data generated by these methods are difficult in detecting some low-probabilistic faults that lie on the covered paths. We present a method of generating test data for covering multiple paths to detect faults in this study. First, we transform the problem of covering multiple paths and detecting faults into a multi-objective optimization problem with constraint, and construct a mathematical model for it. Then, we give a strategy of solving the model based on a weighted genetic algorithm. Finally, we apply our method to several real-world programs, and compare it with several methods. The experimental results confirm that the proposed method can more efficiently generate test data that not only traverse the target paths but also detect faults lying in them than other methods.  相似文献   

7.
动态符号执行是一种有效的软件测试方法,但由于受到约束求解器求解能力的限制,在面对较为复杂的程序和路径条件时,动态符号执行的路径覆盖率还有待提升。针对上述问题,提出了一种遗传算法辅助的动态符号执行测试方法,并基于此方法实现了原型工具JDart-Ga。该方法结合遗传算法的优势,生成约束求解器无法求解的约束条件对应测试输入,从而提升动态符号执行的路径覆盖率。实验结果表明,在测试存在动态符号执行无法覆盖路径的3个实验对象时,所提出方法的路径覆盖率与JDart相比分别提升了16%至23%。  相似文献   

8.
丁蕊  董红斌  冯宪彬  赵佳华 《计算机应用》2016,36(10):2816-2821
针对面向路径覆盖的测试数据生成问题,提出基于烟花爆炸优化算法的测试数据生成方法。首先使用关键点路径表示法表示路径,由理论路径、易覆盖路径和不可行路径得出难覆盖路径,并记录难覆盖路径邻近的易覆盖路径及其测试数据。这些测试数据将作为部分初始烟花以利用其提供的启发信息,其余初始烟花则随机生成。接着根据个体的适应度值设计自适应策略的爆炸半径以提高收敛速度,对爆炸产生的越界火花则使用边界值测试的思想进行修正。与加了启发信息的自适应爆炸半径的烟花算法(NFEO算法)、烟花爆炸优化(FEO)算法、F-method、NF-method等七种基于优化的测试数据生成算法进行了仿真对比实验,实验结果表明:所提算法在测试数据生成时间和迭代次数上都最优。  相似文献   

9.
利用多种群遗传算法解决多路径覆盖问题,是测试数据自动生成领域一个重要的研究方向.为了提高多路径覆盖测试数据自动生成的效率,提出一种将关键点概率和路径相似度相结合的多路径覆盖策略.首先,将理论路径划分成易覆盖、难覆盖及不可达路径;然后,通过易覆盖路径统计关键点概率,依此概率计算个体对生成测试数据的贡献度,并利用贡献度改进...  相似文献   

10.
机器学习方法可很好地与软件测试相结合, 增强测试效果, 但少有学者将其运用于测试数据生成方面. 为进一步提高测试数据生成效率, 提出一种结合SVM (support vector machine)和XGBoost (extreme gradient boosting)的链式模型, 并基于此模型借助遗传算法实现多路径测试数据生成. 首先, 利用一定样本训练若干个用于预测路径节点状态的子模型(SVM和XGBoost), 通过子模型的预测精度值筛选最优子模型, 并根据路径节点顺序将其依次链接, 形成一个链式模型C-SVMXGBoost (chained SVM and XGBoost). 在利用遗传算法生成测试用例时, 使用训练好的链式模型代替插桩法获取测试数据覆盖路径(预测路径), 寻找预测路径与目标路径相似的路径集, 对存在相似路径集的预测路径进行插桩验证, 获取精确路径, 计算适应度值. 在交叉变异过程中引入样本集中路径层级深度较大的优秀测试用例进行重用, 生成覆盖目标路径的测试数据. 最后, 保留进化生成中产生的适应度较高的个体, 更新链式模型C-SVMXGBoost, 进一步提高测试效率. 实验表明, C-SVMXGBoost较其他各对比链式模型更适合解决路径预测问题, 可提高测试效率. 并且通过与已有经典方法相比, 所提方法在覆盖率上提高可达15%, 平均进化代数也有所降低, 在较大规模程序上其降低百分比可达65%.  相似文献   

11.
This paper proposes a genetic-algorithm-based method for selecting a small number of significant fuzzy if-then rules to construct a compact fuzzy classification system with high classification power. The rule selection problem is formulated as a combinatorial optimization problem with two objectives: to maximize the number of correctly classified patterns and to minimize the number of fuzzy if-then rules. Genetic algorithms are applied to this problem. A set of fuzzy if-then rules is coded into a string and treated as an individual in genetic algorithms. The fitness of each individual is specified by the two objectives in the combinatorial optimization problem. The performance of the proposed method for training data and test data is examined by computer simulations on the iris data of Fisher  相似文献   

12.
包晓安  熊子健  张唯  吴彪  张娜 《计算机科学》2018,45(8):174-178, 190
采用遗传算法求解路径覆盖的测试用例生成问题是软件测试自动化的研究热点。针对传统标准遗传方法搜索测试用例易产生早熟收敛和收敛速度较慢的不足,设计了自适应的交叉算子和变异算子,提高了算法的全局寻优能力。基于动态生成算法框架,通过程序静态分析,考虑了分支嵌套深度的影响,结合层接近度和分支距离法,提出一种新的适应度函数。实验结果表明,该算法在面向路径的测试用例生成上优于传统方法,提高了测试效率。  相似文献   

13.
吴川  巩敦卫  姚香娟 《软件学报》2016,27(4):839-854
回归测试是迭代式软件开发的重要环节,测试数据生成是回归测试的前提.传统的回归测试方法,从已有的测试数据中选择部分测试数据,并生成一些新的测试数据,以验证程序的正确性.但是,该方法容易生成冗余的测试数据,从而降低了回归测试的效率.研究了回归测试的分支覆盖问题,通过利用已有测试数据的路径覆盖信息,并选择一定个数的路径,以覆盖所有的目标分支.首先,以若干路径形成的集合作为决策变量,以路径最少、覆盖的分支最多以及包含的未覆盖路径最少为目标,建立路径选择问题的3目标优化模型;然后,采用遗传算法求解上述模型时,设计了基于目标重要性的个体评价策略;最后,基于已有的测试数据与选择的路径之间的覆盖关系,确定需要生成的测试数据.将所提方法应用于6个基准工业程序测试中,并与其他方法比较.实验结果表明,采用该方法选择的路径,能够覆盖更多的分支,需要生成的测试数据更少,回归测试消耗的时间更短.  相似文献   

14.
The problem investigated in this study involves an unrelated parallel machine scheduling problem with sequence-dependent setup times, different release dates, machine eligibility and precedence constraints. This problem has been inspired from a realistic scheduling problem in the shipyard. The optimization criteria are to simultaneously minimize mean weighted flow time and mean weighted tardiness. To formulate this complicated problem, a new mixed-integer programming model is presented. Considering the NP-complete characteristic of this problem, two famous meta-heuristics including a non-dominated sorting genetic algorithm (NSGA-II) and a multi-objective ant colony optimization (MOACO) which is a modified and adaptive version of BicriterionAnt algorithm are developed. Obviously, the precedence constraints increase the complexity of the scheduling problem in strong sense in order to generate feasible solutions, especially in parallel machine environment. Therefore a new corrective algorithm is proposed to obtain the feasibility in all stages of the algorithms. Due to the fact that appropriate design of parameter has a significant effect on the performance of algorithms, we calibrate the parameters of these algorithms by using new approach of Taguchi method. The performances of the proposed meta-heuristics are evaluated by a number of numerical examples. The results indicated that the suggested MOACO statistically outperformed the proposed NSGA-II in solving the test problems. In addition, the application of the proposed algorithms is justified by a real block erection scheduling problem in the shipyard.  相似文献   

15.
自动生成测试数据的关键在于能否生成覆盖率高、纠错能力强的数据。针对目前测试数据生成效率低及黑猩猩优化算法仍存在易陷入局部最优、收敛精度低等问题,提出一种正余弦扰动策略黑猩猩优化算法(chimp optimization algorithm for sine-cosine perturbation strategy,SC-ChOA)。使用拉丁超立方策略初始化种群,增强种群的多样化;引入非线性衰减收敛因子来平衡算法的全局和局部勘探能力;在位置更新时添加正余弦扰动因子,避免群体陷入局部范围搜索而导致的算法停滞现象。使用测试函数与标准黑猩猩优化算法及常用的遗传算法进行对比实验,验证算法的有效性;将改进算法应用到测试数据生成领域,通过在桩中插入分支函数来建立适应度函数,以促进测试数据的优化。为验证改进算法在测试数据生成方面的有效性,使用多个基准程序进行算法对比实验,结果表明SC-ChOA在测试数据生成的覆盖率、平均迭代次数和运行时间上均有明显优势。  相似文献   

16.
In this paper, the authors describe a novel technique based on continuous genetic algorithms (CGAs) to solve the path generation problem for robot manipulators. We consider the following scenario: given the desired Cartesian path of the end-effector of the manipulator in a free-of-obstacles workspace, off-line smooth geometric paths in the joint space of the manipulator are obtained. The inverse kinematics problem is formulated as an optimization problem based on the concept of the minimization of the accumulative path deviation and is then solved using CGAs where smooth curves are used for representing the required geometric paths in the joint space through out the evolution process. In general, CGA uses smooth operators and avoids sharp jumps in the parameter values. This novel approach possesses several distinct advantages: first, it can be applied to any general serial manipulator with positional degrees of freedom that might not have any derived closed-form solution for its inverse kinematics. Second, to the authors’ knowledge, it is the first singularity-free path generation algorithm that can be applied at the path update rate of the manipulator. Third, extremely high accuracy can be achieved along the generated path almost similar to analytical solutions, if available. Fourth, the proposed approach can be adopted to any general serial manipulator including both nonredundant and redundant systems. Fifth, when applied on parallel computers, the real time implementation is possible due to the implicit parallel nature of genetic algorithms. The generality and efficiency of the proposed algorithm are demonstrated through simulations that include 2R and 3R planar manipulators, PUMA manipulator, and a general 6R serial manipulator.  相似文献   

17.
归一化实数编码的多维并行遗传算法   总被引:7,自引:0,他引:7  
廖平 《计算机仿真》2005,22(10):122-124
给出了归一化多维实数编码的基本定义,并在此基础上提出了基于归一化实数编码的多维并行遗传算法;对归一化实数编码多维并行交叉算子、多维并行变异算子进行了详细的研究;提出了多维优化问题归一化实数编码长度计算公式;对遗传算法的控制参数确定进行了阐述;对归一化实数编码的多维并行遗传算法适应度函数的确定方法进行了研究.实验表明,归一化实数编码多维并行遗传算法可以大大提高多维优化问题的收敛速度,从而进一步提高算法的性能,这些特点对于计算复杂的非线性多维优化问题具有重要的意义.  相似文献   

18.
This paper proposes a dynamic test data generation framework based on genetic algorithms. The framework houses a Program Analyser and a Test Case Generator, which intercommunicate to automatically generate test cases. The Program Analyser extracts statements and variables, isolates code paths and creates control flow graphs. The Test Case Generator utilises two optimisation algorithms, the Batch-Optimistic (BO) and the Close-Up (CU), and produces a near to optimum set of test cases with respect to the edge/condition coverage criterion. The efficacy of the proposed approach is assessed on a number of programs and the empirical results indicate that its performance is significantly better compared to existing dynamic test data generation methods.  相似文献   

19.
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.  相似文献   

20.
This paper presents a technique that uses a genetic algorithm for automatic test‐data generation. A genetic algorithm is a heuristic that mimics the evolution of natural species in searching for the optimal solution to a problem. In the test‐data generation application, the solution sought by the genetic algorithm is test data that causes execution of a given statement, branch, path, or definition–use pair in the program under test. The test‐data‐generation technique was implemented in a tool called TGen, in which parallel processing was used to improve the performance of the search. To experiment with TGen, a random test‐data generator called Random was also implemented. Both Tgen and Random were used to experiment with the generation of test‐data for statement and branch coverage of six programs. Copyright © 1999 John Wiley & Sons, Ltd.  相似文献   

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

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

京公网安备 11010802026262号