数据流覆盖可有效地检测软件中的缺陷与错误。针对该覆盖准则中存在的插装监测开销庞大和测试数据生成效率不高的问题,提出一种新的基于定值一引用对覆盖的测试数据进化生成方法。该方法主要分为两部分,首先,通过约减测试目标来减少插装开销,提出的包含关系算法可找到一个定值-引用对子集,使得覆盖该子集就能保证所有测试目标被覆盖;然后,采用遗传算法为所有测试目标生成测试数据,设计的适应度函数综合考虑个体实际执行的路径与每个测试目标的定义明确路径的匹配程度。将该方法用于8个基准程序的测试数据生成,并与其他方法比较,结果显示其可有效提高程序覆盖率和测试数据生成效率。
Data-flow coverage is an effective and adequacy criterion for detecting defects in the program. Aim at the existing problems such as the monitoring costs caused by instrumentation is huge and the inefficiency of test data generation for this criterion, a novel approach to generating test data for all definition-use pairs coverage is presented. This approach consists two parts, first, cutting the monitoring costs by reducing the number of testing requirements, the proposed subsumption algorithm identifies a subset of definition- use pairs, which can guarantee the coverage of all test requirements is achieved; then, the genetic algorithm is used to generate multi- ple test data for all definition-use pairs. , the fitness of individual depends on the matching degree between the traversed path and the definition-clear path of each targeted definition-use pair. The proposed approach is applied to generate test data for 8 benchmark pro- grams, the experiment result shows that it can greatly improve the coverage of programs and the efficiency of test data generation when comparing with other approaches.