节点文献

测试用例自动生成中人工智能的应用研究

The Application Research of Artificial Intelligence in Automatic Test Case Generation

【作者】 张博

【导师】 宫云战;

【作者基本信息】 北京邮电大学 , 计算机科学与技术, 2018, 硕士

【摘要】 测试用例自动生成问题作为软件测试中的一个基本问题,解决测试用例自动生成问题对软件测试中的覆盖率测试尤为重要。另外,人工智能技术作为最前沿的技术之一,可以被应用到各种领域中。应用人工智能技术到代码测试中的测试用例生成问题,用于改善测试效率极具可行性和重要性。针对上述问题,本文应用人工智能中机器学习和启发式搜索的技术到测试用例生成问题中。本文的研究内容主要分为三部分:第一部分基于机器学习中人工神经网络的技术实现了预测测试用例时间的功能。该研究首先确定影响测试用例生成的因素是与代码度量相关的指标,接着通过自动化测试工具统计该指标,生成数据集。最后通过实验对模型中的参数进行修正和确认,实验证明模型对测试用例生成时间的预测准确度超过80%。该策略可以帮助测试人员在代码覆盖率测试时提前获得测试的进度,了解每个函数、文件和工程进行测试所需要的时间,从而确定测试过程的工作量。第二部分应用强化学习的技术,利用其模拟人类利用经验进行决策的能力指导测试用例的自动生成。该方法对约束求解中变量运算的过程进行抽象建模,模型实现了对约束集合的智能求解。即选择合适的变量并选择合适的动作进行运算。通过实验证明了该策略的可行性,并确认该方法可以生成正确的测试用例。另外,实验对比不加入强化学习策略的测试用例生成方法中变量的运算次数,证明了该策略在减少变量计算次数的可行性。第三部分是对基于分支限界的测试用例生成框架进行完善,分支限界测试用例生成框架是人工智能搜索算法的应用,该部分研究提出了一种针对测试用例生成中的等式约束条件的处理策略。通过对包含等式和不等式约束的被测程序进行测试,证明该策略可以提高测试用例生成的效率并检测出由等式无解所造成的不可达路径。作者基于代码测试系统(CodeTest System,CTS)对上述三种策略进行开发和测试。应用研究的目的在于改善CTS的测试效率。通过设计的实验可以验证这三种策略在改善测试用例生成上的可行性。

【Abstract】 The problem of automatic test case generation is the basic problem in software testing.It is very important to solve the problem of test case generation for coverage test in software testing.In addition,artificial intelligence technology,as one of the most advanced technologies,can be applied to various fields.It is very feasible and important to apply the artificial intelligence technology to test case generation in software test,and the application of artificial intelligence is to improve the efficiency of testing.In order to solve the problems mentioned above,the technology of machine learning and heuristic search in artificial intelligence is applied to the problem of test case generation.The research contents of this paper are mainly divided into three parts.The first part is based on the technology of artificial neural network in machine learning,and realizes the function of predicting test case generation time.The research firstly determines the factors that influence test case generation are related to code metrics,and then statistics the index through automated testing tools to generate data sets.Finally,the parameters in the model are corrected and confirmed by experiments.The experimental results show that the prediction accuracy of the model for the generation time of test cases is higher than 80%.This strategy can help the tester get the progress of the test ahead of time in the code coverage testing,and understand the needed time for each file and project,so that the tester can grasp the workload of the test.The second part applies the technology of reinforce learning in machine learning,and realizes the automatic generation of test cases by simulating its ability of human making decision by experience.In this method,the process of variable operation in constraint solving is modeled in an abstract way.The model realizes the intelligent solution of constraint set through selecting the appropriate variables and actions to perform operations.The experiment proves the feasibility of the strategy and confirms that the method can generate the correct test case.In addition,the experiment compares the number of variables in test case generation method without reinforcement learning strategy,which proves the feasibility of this strategy in reducing the number of variables operations.The third part is to improve the test case generation framework based on branch and bound.Branch and bound test case generation framework is the application of artificial intelligence search algorithm.In this part,a processing strategy for equality constraint condition in test case generation is proposed.By testing the program containing equality and inequality constraints,we can find that this strategy can reduce the number of interval operations,and significantly improve the efficiency of test case generation.In addition,this strategy can be used to detect the unreachable path caused by the unsolvable equation.The author develops and tests the three strategies based on the code test system(CTS).The purpose of application research is to improve the testing efficiency of CTS.The experiment can verify the feasibility of these three strategies in improving test case generation.

  • 【分类号】TP311.53;TP18
  • 【被引频次】2
  • 【下载频次】505
  • 攻读期成果
节点文献中: