为了提高软件测试中组合测试的效率,进一步精简组合测试用例的数量,提出了基于矩阵重复度的最小组合测试用例生成算法.首先根据因素个数和每个因素取值个数生成输入矩阵,然后采用比较重复度的方法生成初步的解矩阵;接着验证生成的解矩阵是否能覆盖所有的因素组合,并将没有覆盖的因素组合记录下来;最后采用贪心算法的思想覆盖那些未被覆盖的因素组合,得到最终的解矩阵.解矩阵中的每一行即为一个有效测试用例.最后与常用的组合测试工具ACTS及PICT进行了对比试验,比较了低因素覆盖、高因素覆盖和各因素参数不同的3种情况.试验结果表明,所提出方法在保证因素组合全部覆盖的情况下生成的测试用例个数较少,优于ACTS和PICT,从而证实了该方法的可行性.
To improve the efficiency of combinatorial testing and reduce the numbers of test cases of combinatorial test, based on matrix repeat degree, an algorithm was proposed to generate the minimum numbers of test cases. An input matrix was generated based on the numbers of factors and the value numbers of each factors. The initial solution matrix was generated by comparing repeat degree of input matrix. The solution matrix was verified to decide whether all combinations of factors were covered, and the uncovered combinations of factors were recorded. To obtain the final solution matrix, the greedy algorithm was used to cover the uncovered combinations of factors. Each row of the solution matrix was a valid test case. The proposed approach was compared with the common combinatorial testing tools of ACTS and PICT for low factors cover, high factors cover and various different parameters. The experimental results show that the proposed approach can generate less numbers of test cases to ensure that all factor combinations are covered. The proposed approach is superior to ACTS and PICT, which proves to be feasible and effective.