中国综合性科技类核心期刊(北大核心)

中国科学引文数据库来源期刊(CSCD)

美国《化学文摘》(CA)收录

美国《数学评论》(MR)收录

俄罗斯《文摘杂志》收录

留言板

尊敬的读者、作者、审稿人, 关于本刊的投稿、审稿、编辑和出版的任何问题, 您可以本页添加留言。我们将尽快给您答复。谢谢您的支持!

姓名
邮箱
手机号码
标题
留言内容
验证码

一种分布式可视化Dubbo接口测试平台

李艳丽 张宗勇 冯捷 李志辉

李艳丽, 张宗勇, 冯捷, 李志辉. 一种分布式可视化Dubbo接口测试平台[J]. 华东师范大学学报(自然科学版), 2019, (4): 120-132, 143. doi: 10.3969/j.issn.1000-5641.2019.04.012
引用本文: 李艳丽, 张宗勇, 冯捷, 李志辉. 一种分布式可视化Dubbo接口测试平台[J]. 华东师范大学学报(自然科学版), 2019, (4): 120-132, 143. doi: 10.3969/j.issn.1000-5641.2019.04.012
LI Yan-li, ZHANG Zong-yong, FENG Jie, LI Zhi-hui. A distributed user-friendly Dubbo interface testing platform[J]. Journal of East China Normal University (Natural Sciences), 2019, (4): 120-132, 143. doi: 10.3969/j.issn.1000-5641.2019.04.012
Citation: LI Yan-li, ZHANG Zong-yong, FENG Jie, LI Zhi-hui. A distributed user-friendly Dubbo interface testing platform[J]. Journal of East China Normal University (Natural Sciences), 2019, (4): 120-132, 143. doi: 10.3969/j.issn.1000-5641.2019.04.012

一种分布式可视化Dubbo接口测试平台

doi: 10.3969/j.issn.1000-5641.2019.04.012
详细信息
    作者简介:

    李艳丽, 女, 硕士, 平安壹钱包资深测试, 主要研究方向为自动化测试和中间件测试.E-mail:liyanlyee@qq.com

    通讯作者:

    张宗勇, 男, 平安壹钱包高级总监, 主要研究方向为互联网技术及安全.E-mail:zzynet@163.com

  • 中图分类号: TP399

A distributed user-friendly Dubbo interface testing platform

  • 摘要: 随着互联网金融的发展,金融业务变得更加复杂,产品功能迭代更加快速.为了支持业务的发展,金融应用开始进行支持Dubbo协议的开发.现有的接口测试框架和工具在支持Dubbo协议、多人协作及测试用例维护及数据分析上都存在问题:首先,没有很好的工具支持Dubbo协议的测试,已有的Dubbo测试框架无法很好地推广;其次,复杂业务会涉及多个应用,目前的框架很少考虑多系统间的自动化配合;再次,单机版自动化测试工具或纯编码方式的自动化测试框架不利于多人协作编写自动化测试用例及脚本的维护;最后,数据分析一般是查看单个子系统测试用例的执行结果,无法很好地对数据进行全局分析.为了更好地管理大批量用例及支持多子系统版本迭代,在已有老框架基础上,使用分布式技术设计并实现了一个灵活的可视化的Dubbo接口自动化测试平台:基于界面操作,提供基于可视化的数据驱动及关键字驱动方式,支持编写复杂测试用例,并基于接口解析的方式,自动生成测试用例.详细表述了可视化的Dubbo接口测试平台的架构、用例管理及用例执行;展示了新平台与老框架的耗时对比、用例增长对比和新平台日常自动化执行情况.
  • 图  1  Dubbo接口测试平台架构

    Fig.  1  Architecture of the Dubbo interface testing platform

    图  2  用例管理架构图

    Fig.  2  Architecture of case management

    图  3  Dubbo接口测试平台技术架构图

    Fig.  3  The technical architecture of the Dubbo interface testing platform

    图  4  用例执行架构图

    Fig.  4  Architecture of test case execution

    图  5  依赖系统信息

    Fig.  5  Information on Dependent Systems

    图  6  包含3个步骤的测试用例

    Fig.  6  Test case with three test steps

    图  7  测试步骤示例

    Fig.  7  Example of One Test Step

    图  8  新旧自动化接口测试用例增长对比数据

    Fig.  8  Automated interfaces test case growth comparison between the old and new framework

    表  1  用例关键字

    Tab.  1  Keywords of cases

    用例关键字 说明
    $app.config(key) 获取配置项key的值
    $app.globalConfig(key) 获取系统级配置项key的值
    $app.request.key 获取请求报文中key的值
    $app.content.key 获取返回报文中key的值
    $app.addContext(key, value) 把key及value值加入上下文
    $app.getContext(key) 通过key, 把对应的value值从上下文中取出
    dataSet[key] 通过key, 取出数据集中对应的value值
    $app.assert(key, value) 通过key, 验证期望的是value值
    下载: 导出CSV
    算法1  负载均衡规则算法
    输入:负载均衡对象ILoadBalancer lb
    输出:选取的执行server
    1: hashKey $\leftarrow $从线程上下文中获取子系统对应版本的唯一标志appId
    2: while true
    3:    do servers.clear(); //servers保存负载均衡需要选取的work(server)
    4:    if server = null且count++ $ < $ 10 then //try ten times
    5:      reachableServers $\leftarrow $ lb.getReachableServers(); //reachableServers's
    6: type is List which saves the normal work instances
    7:       allServers $\leftarrow $ lb.getAllServers(); //通过负载均衡对象获取所有servers
    8:       for server1 in allServers
    9:         do o $\leftarrow $从缓存中获取不满足要求的server列表
    10:            If o=null then
    11:               servers.add(server1);//把满足要求的server1存入servers
    12:              end
    13:      upCount $\leftarrow $ reachableServers.size(); //可以使用的servers大小
    14:      serverCount $\leftarrow $ servers.size();
    15:      if upCount!=0且serverCount!= 0 then
    16:         servers.sort(); //根据appId对servers进行排序
    17:        index $\leftarrow $ Integer.valueOf(HashKey) % serverCount; //选择server
    18:        server $\leftarrow $ servers.get(index);
    19:      if server = null then
    20:       Thread.yield();
    21:      elseif
    22:      再次从缓存中获取不满足要求的servers列表!=null
    23:         Continue;
    24:       if server.isAlive()且server.isReadyToServe() then //判断server可用
    25:         return server;
    26:       else server $\leftarrow $ null;
    27:     else continue;
    28:    else return null;
    29: end
    下载: 导出CSV

    表  2  新旧耗时对比数据

    Tab.  2  Cost vs. time comparison between the old and new framework

    老框架 新平台
    准备测试环境 4 h/人 0
    准备测试用例(单步骤) 3 min/个 1 min/个
    执行测试用例(单步骤) 1 min/个 0.3 s/个
    准备测试用例(复杂场景) 20 min/个 3 min/个
    多环境适配(单步骤) 4 min/个 1.3 min/个
    多环境适配(复杂场景) 20 min/个 3 min/个
    分析测试结果 2 h/子系统 1 h/子系统
    汇总 6.8 h 1.2 h
    下载: 导出CSV

    表  3  用例日常执行数据

    Tab.  3  Execution records of daily cases

    子系统-版本 TC总数 TC成功率/% 步骤总数 行覆盖率/% 执行耗时
    1-20180510 1 267 64.40 6852 46.22 81 min
    2-20180510 773 96.64 1 744 39.89 8 min35 s
    3-20180510 773 66.24 1 422 11.36 8 min20 s
    4-20180510 700 76.88 2 122 22.32 37 min16 s
    5-20180510 550 84.24 563 31.95 7 min42 s
    6-20180510 504 93.45 523 35.24 1 min43 s
    7-20180510 451 94.92 696 45.22 6 min58 s
    8-20180510 419 71.26 432 25.16 7 min17 s
    9-20180510 378 88.62 2 203 27.53 23 min49 s
    10-20180510 336 97.24 420 47.90 2 min29 s
    下载: 导出CSV
  • [1] 席涛, 郑贤强.大数据时代互联网产品的迭代创新设计方法研究[J].包装工程, 2016, 37(8):1-4. http://www.wanfangdata.com.cn/details/detail.do?_type=perio&id=bzgc201608001
    [2] 周永红, 张彦祥.金融软件的自动化测试探索与创新之路[J].中国金融电脑, 2018(1):64-68. doi:  10.3969/j.issn.1001-0734.2018.01.015
    [3] TAY B H, ANANDA A L. A survey of remote procedure calls[J]. ACM SIGOPS Operating Systems Review, 1990, 24(3):68-79. doi:  10.1145/382244
    [4] APACHE SOFTWARE FOUNDATION. Apache Dubbo[OB/OL].[2018-06-20]. http://Dubbo.apache.org/.
    [5] SoapUI. Available[EB/OL]. (2017-12-04)[2018-07-01]. https://www.soapui.org/.
    [6] SOAP. WWW, Service Architecture, Soap[EB/OL]. (2016-07-17)[2018-07-01]. https://www.service-architecture.com/articles/web-services/soap.html.
    [7] 杨超.基于分布式服务框架Dubbo的集群式服务器的研究与实现[D].北京: 北京邮电大学, 2017. http://cdmd.cnki.com.cn/Article/CDMD-10013-1017292258.htm
    [8] Apache JMeterTM. The Apache Software Foundation[EB/OL]. (2016-07-17)[2018-07-01]. http://jmeter.apache.org/index.html.
    [9] MICRO FOCUS. LoadRunner Load Testing Software[EB/OL]. (2017-08-30)[2018-07-01]. https://www.microfocus.com/en-us/products/loadrunner-load-testing/overview.
    [10] NIELSEN H F, GETTYS J, BAIRD-SMITH A, et al. Network performance effects of HTTP/1.1[J]. ACM Sigcomm Computer Communication Review, 1997, 27(4):155-166. doi:  10.1145/263109
    [11] MENG F Y. Phoenix Framewor[EB/OL]. (2016-07-17)[2018-07-01]. http://www.cewan.la/.
    [12] SHANG Y, ZHANG X L, FENG Y B, et al. Research and application of automated testing tool based on STAF[C]//Proceedings of the 2nd International Conference on Computer Science and Electronics Engineering. Paris: Atlantis Press, 2013: 2336-2339.
    [13] SOURCE FORGE. Software Testing Automation Framework (STAF)[EB/OL]. (2016-12-31)[2018-07-01]. http://staf.sourceforge.net/index.php.
    [14] HE Z H, ZHANG X, ZHU X Y. Design and implementation of automation testing framework based on keyword driven[J]. Applied Mechanics and Materials, 2014, 602/603/604/605:2142-2146. http://www.wanfangdata.com.cn/details/detail.do?_type=perio&id=10.4028/www.scientific.net/AMM.602-605.2142
    [15] ECMA INTERNATIONAL. The JSON Data Interchange Syntax[EB/OL]. (2016-12-31)[2018-07-01]. http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf.
    [16] JOY J, SINGH D P. A generic framework design to enhance capabilities of an enterprise test automation framework[C]//International Conference on Applied and Theoretical Computing and Communication Technology. IEEE, 2016: 207-212.
    [17] GRIFFIN L, RYAN K, DE LEASTAR E, et al. Scaling instant messaging communiction services: A comparison of blocking and non-blocking techniques[C]//2011 IEEE Symposium on Computers and Communications. IEEE, 2011: 550-557.
    [18] JUNQUEIRA F, REED B. ZooKeeper: Distributed Process Coordination[M].[S.l]: O'Reilly Media, Inc. 2013.
    [19] BURROWS M. The Chubby lock service for loosely-coupled distributed systems[C]//OSDI'06: 7th USENIX Symposium on Operating Systems Design and Implementation. USENIX Association, 2006: 335-350.
    [20] MAVEN. The Apache Software Foundation[EB/OL].[2018-07-01]. https://maven.apache.org/what-is-maven.html.
    [21] TestNG. The Apache Software Foundation[EB/OL]. (2017-12-19)[2018-07-01]. http://testng.org/doc/documentation-main.html.
    [22] REESE W. Nginx:The high-performance web server and reverse proxy[J]. Linux Journal, 2008, 2008(173):2. http://d.old.wanfangdata.com.cn/Periodical/jsjxtyy201306048
    [23] GITHUB. Netflix, Eureka[EB/OL].[2018-07-01]. https://github.com/Netflix/eureka.
    [24] EHCACHE. Software AG USA[EB/OL]. (2017-05-25)[2018-07-01]. http://www.ehcache.org/about/index.html.
    [25] REDIS. Redis Labs[EB/OL]. (2017-07-00)[2018-07-01]. https://redis.io/topics/introduction.
    [26] Netflix, Ribbon[EB/OL]. (2018-04-28)[2018-07-01]. https://github.com/Netflix/ribbon.
  • 加载中
图(8) / 表(4)
计量
  • 文章访问数:  122
  • HTML全文浏览量:  97
  • PDF下载量:  69
  • 被引次数: 0
出版历程
  • 收稿日期:  2018-08-06
  • 刊出日期:  2019-07-25

目录

    /

    返回文章
    返回