ISSN 1000-1239 CN 11-1777/TP

计算机研究与发展 ›› 2018, Vol. 55 ›› Issue (2): 358-376.doi: 10.7544/issn1000-1239.2018.20160721

• 软件技术 • 上一篇    下一篇

服务接口测试自动化工具的研究

卓欣欣2, 白晓颖1, 许静2, 李恩鹏2, 刘喻1, 康介恢2, 宋文莉2   

  1. 1(清华大学计算机科学与技术系 北京 100084); 2(南开大学计算机与控制工程学院 天津 300350) (zhuoxinxin@mail.nankai.edu.cn)
  • 出版日期: 2018-02-01
  • 基金资助: 
    国家重点研发计划项目(2016YFB1000504);国家自然科学基金项目(61472197)

A Tool for Automatic Service Interface Testing

Zhuo Xinxin2, Bai Xiaoying1, Xu Jing2, Li Enpeng2, Liu Yu1, Kang Jiehui2, Song Wenli2   

  1. 1(Department of Computer Science and Technology, Tsinghua University, Beijing 100084); 2(College of Computer and Control Engineering, Nankai University, Tianjin 300350)
  • Online: 2018-02-01

摘要: 在面向服务的架构中,软件功能通常被封装为服务,并以开放可编程接口的方式提供应用.因此,服务接口的正确性和可靠性对于服务理解、重用和集成至关重要.随着软件即服务的思想被广为认可,互联网上越来越多的软件应用以服务接口方式提供开放式访问.面对众多的服务接口,如何进行高效且有效的测试是一个亟待解决的问题.为此,提出了一种基于模型驱动的自动化测试方法,首先采用接口语义契约模型对被测服务接口建模,然后基于接口模型和测试覆盖率需求为单个服务和组合服务生成测试数据和测试用例.在此基础上,设计并实现了AutoTest自动化测试工具,该工具采用多种算法用于优化测试用例生成,且支持图形化测试计划编排和跨语言测试代码生成.实验结果表明,AutoTest能够有效支持大批量测试用例的设计和生成,根据OED(正交实验设计)算法生成的测试用例与IPO组合算法得到的用例相比,具有更为理想的测试覆盖率.

关键词: 服务接口, 模型驱动测试, 测试用例生成, 自动化测试, 测试工具

Abstract: In SaaS (software-as-a-service), software functions are encapsulated as independent and self-contained services, and users can access these services through well-defined interface. The correctness and reliability of service interfaces are critical for service understanding, reuse and integration. With the increasing acceptance of SaaS, more and more software expose interfaces for Internet-based open access. API testing for service interfaces is thus getting increasing attentions. To this end, a model-driven automatic testing method is presented to facilitate efficient and effective service interfaces testing. A model called ISC (interface semantic contract) is defined for modeling services with domain knowledge. Following the model-driven approach, tests are generated from ISC at three levels: test data, test cases for individual services and for composite services. Test cases are then translated to target programming languages through a kind of meta-model defined for test cases. An automatic testing tool (AutoTest) has been designed and implemented, which integrates various algorithms to optimize test generation. What’s more, the tool supports design test plan in graphical form and generates test cases in multiple programming languages, for example, C++ or Java. Experimental results demonstrate that AutoTest can support design and generation of large quantities of test cases effectively and efficiently, and test cases generated by OED (orthogonal experimental design) algorithm have more satisfactory test coverage than those by pairwise IPO (in parameter order) algorithm.

Key words: service interface, model-driven test, test cases generation, automatic test, testing tool

中图分类号: