软件测试中的Mock辅助生成技术研究
DOI:
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

TP311.5, TN06

基金项目:


Research on aided generation technology of Mock in software testing
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    Mock技术对提高软件单元测试的独立性和全面性起到了重要作用。现有的Mock生成框架需要人为编写Mock方法的逻辑,工作量较大且易引入人为错误。针对测试中Mock方法构建效率较低的问题,提出了一种基于数据驱动思想的Mock辅助生成方法,定义Mock模型描述要实现的内部逻辑,从而将输入输出数据独立于测试脚本。首先,通过对程序的分析,辅助确定待模拟方法及其输入输出参数;其次,针对输入输出关系进行建模;然后,根据输入输出关系为待模拟方法生成Mock方法;最后,将被测对象中的待模拟方法替换为Mock方法。通过实验,证明了所提出方法的有效性。

    Abstract:

    Mock technology plays an important role in improving the independence and comprehensiveness of software unit testing. The existing Mock generation framework needs to write the logic of Mock method manually, which leads to heavy workload and possibly introduce human errors. In view of the low efficiency of Mock method construction in testing, an aided generation method of Mock based on data driven idea is proposed, which defines the Mock model to describe internal logic of the implementation, so that the input and output data are independent of the test script. Firstly, through the analysis of programs under test, the simulated method and its input and output parameters are found and analyzed. Secondly, the input and output relationship is modeled. Thirdly, the Mock method is generated for the simulated method based on the input and output relation. Finally, the simulated method in programs under test is replaced by the Mock method. The effectiveness of the proposed method is proved by experiments.

    参考文献
    相似文献
    引证文献
引用本文

冯俊池,连尧,董超,尹党辉.软件测试中的Mock辅助生成技术研究[J].电子测量技术,2019,42(6):48-51

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:
  • 最后修改日期:
  • 录用日期:
  • 在线发布日期: 2021-08-03
  • 出版日期: