恰如其分的自动化测试

如果无法正常显示,请先停止浏览器的去广告插件。
分享至:
1. e t s e T o H r e m e t s e T o rH e m e t s e T o rH e m
2. e t s e T o H r e m 恰如其分的自自动化测试 o rH e m e t 张天博 – 淘宝测试开发专家 s e T e t s e T o rH e m
3. e t s e T o H r e m 讲师介绍
 背景说明
 Agenda e m 解题思路路
 o H r te s e T 案例例成果
 延伸领域 e t s e T o rH e m
4. 张天博(搏天) e m 淘宝技术质量量部 测试开发专家
 o H r e t s e T e m 9年年运维、测试、开发、运维、前端、咨询经验, 目目前负责淘宝内容部分的质量量 o H r e t e 主要研究方方向: 测试工工程效率、 e 算法评测等 s m T o H r e t s e T
5. e t s e T o H r e m 背景介绍 e s e T H r te m o e t s e T o rH e m
6. 背景 e t s e T o H r • 2000+个应用用 e m • 6万+次应用用变更更/年年 e t s e T •4月月 •6月月 e m o H r • 多应用用、多部⻔门之间协调 e t s e T o rH e m
7. 质量量稳定性挑战 e t s e T o H r e m “如何保证发布的变更更不不影响已有逻辑?” “如何保证大大范围内的主链路路质量量?” o rH e m e t s “如何最大大限度的保证测试覆盖?” e T e t s e T o rH e m
8. e t s e T o H r e m 线上流量量录制回放 e s e T H r te m o e t s e T o rH e m
9. 要求 •0代码改造 o H r e t • 在线启停 s e T e m e t s e T • 稳定, 系统性能影响足足够小小 o rH • 兼容绝大大部分的RPC场景(db\cache等) e m e t s e T o rH e m
10. JVM Sandbox 介绍 o H r e m e t JVM非非侵入入式运行行行期AOP解决方方案 s e T o rH e m e t s 特点: 无无侵入入、 类隔离、 热插拔、 e 多租户、 高高兼容 T e t s e T 开源地址: https://github.com/alibaba/jvm-sandbox (2400+star,40+pr) o rH e m
11. 做法 – 录制 Service Method e t s e T o H r e m RPC Invoker/Handler JVM-sandbox AOP • Before Request • Return Response • Throw Throwables e t s e T Networking o rH e m Serialize 01001010010100 10100100101001 01001010010010 10010010100101 00101001001010 01001010010100 1010 e m RpcRecord e t s e T o rH
12. 做法 – 回放 01001010010100 10100100101001 01001010010010 10010010100101 00101001001010 01001010010100 1010 e t s e T Local invoke e m {Request Object} o DeSerialize H r RpcRecord Service Method JVM-sandbox Invoker o rH {Response Object} e t s e T e m Diff Assertion RPC Invoker/Handler e t s e T o rH e m
13. Review 优点 • 0代码改造 √ e m • 在线启停 √ o H r e t s • 稳定, 系统性能影响在足足够小小√ e T e m • 兼容绝大大部分的RPC场景 √ o H r e t s e T 不不足足 • 只敢执行行行只读接口口, 写操作不不敢执行行行 e t s e T o rH e m
14. e t s e T o H r e m 写行行行为录制回放 e s e T H r te m o e t s e T o rH e m
15. 写操作解题思路路 •识别常规请求和回放, 区别行行行为 e m •识别同一一次全链路路请求和子子链路路请求(可以参考google dapper定义) o H r e t •定义链路路请求(对内、对外),建立立统一一资源定义(URI) s e T e m • 例例如: dubbo://com.test.qa.InterfaceX@methodY~Type1,Type2 o H r e t s e (c1,c2) values(?,?) • 例例如: mysql://insert into test T table e t s e • 例例如: java://com.test.qa.nativeMethod@methodM~Type3,Type4 T • 利利用用aop能力力力, 将同URI的从录制结果中直接返回 o rH e m
16. 做法 – 录制 Service Method e t s e T Handler 1 o H r Handler 2 e m JVM-sandbox AOP Handler … • • • • Before Request Return Response Throw Throwables URI e t s e T Networking o rH e m Serialize 01001010010100 10100100101001 01001010010100 01001010010010 01001010010100 10100100101001 10010010100101 10100100101001 01001010010010 00101001001010 01001010010010 10010010100101 01001010010100 10010010100101 00101001001010 1010 00101001001010 01001010010100 1.1 01001010010100 1010 1010 1.2 e RpcRecords m o H r e t s e T
17. 做法 – 回放 Local invoke o H r DeSerialize 0100101001 0100101001 0010100101 0010100100 101001001 e t s e T e m {Request Object} Root RpcRecord JVM-sandbox Invoker {Response Object} e t s e T o rH e m 01001010010 10010100100 01001010010 10100101001 10010100100 01001001010 10100101001 01001 01001001010 01001 • • • • • URI Type Seq Request Script engine Sub RpcRecord Diff Assertion Service Method interceptor Handler 1 e t s e T Networking o rH e m
18. Review 优点 • 0代码改造 √ e m • 在线启停 √ o H r e t s • 稳定, 系统性能影响在足足够小小√ e T e m • 兼容绝大大部分的RPC场景 √ o H r e t s • 全部场景覆盖 √ e T 不不足足 • 量量太大大, 回归和排查成本依旧高高 e t s e T o rH e m
19. e t s e T o H r e m 测试范围分析 e s e T H r te m o e t s e T o rH e m
20. 现状 TC1 e t s e T TC2 o H r TC3 e m TC4 •量量化发现系统中的变更更点 入入口口 • 将变更更点转化到回归范围上 逻辑 e t s e T o rH e m e t s e T o rH e m
21. 预期 •从接口口感知整个链路路的代码变化 o H r e m e t • 通过代码变化确定测试行行行为变化  s e T e t s e T o rH e m • 通过测试行行行为变化驱动我们更更加准确地驱动测试行行行动 e t s e T o rH e m
22. 评估变更更 •从入入口口流量量到最终同JVM的所有调用用信息,可以区分同一一接口口下的不不同链路路 e t s e T o H r e m • 所有调用用经过的class需要版本化, 感知同链路路下的class变更更 • 生生成调用用链路路 e t s e • 对比比录制链路路和回放链路路,生生成变更更影响 T o rH e m e t s e T o rH e m
23. 落地设计 Storage 应用用JVM e m 链路路 数据 JVM_SANDBOX 正常流量量 e t s e T o H r 流量量 数据 链路路识别 正常返回 流量量识别 回放返回 回放流量量 e t s e T 重放器器 o rH e m 链路路 数据 流量量 数据 分析中心心 Risk: 10 增加Class: 3 减少Class: 4 修改Class: 2 e t s e T o rH e m
24. 链路路变更更效果 e t s e T o H r e m e t s e T o rH e m e t s e T o rH e m
25. e t s e T o H r e m e “究竟要执行行行多少线上用用例例才能覆盖完链路路?” m o H r e t e s e m T o H r e t s e T
26. 覆盖率的目目标 e t s e T o H r e m e t s e T o rH e m e t s e T o rH e m
27. 覆盖率与链路路聚类方方法 e t s e T o H r e m e t s e T o rH e m e t s e T o rH e m
28. 聚类覆盖效果 e t s e T o H r e m e t s e T o rH e m e t s e T o rH e m
29. 聚类覆盖效果 e t s e T o H r e m e t s e T o rH e m e t s e T o rH e m
30. e t s e T o H r e m 案例例成果 e s e T H r te m o e t s e T o rH e m
31. 整体架构 e JVM-Sandbox o Module m H r e t s e T repeater trace Platform MQ http e t s e T 聚类器器 o rH e m 分析器器 db Module管理理 Module挂载 es e t s e T o rH e m
32. 效果介绍 •目目前淘宝的大大型重构、迁移类项目目全部都通过平台承载, 基础升级回归几几乎0成本 e m o •一一些数据: H r e t s e T • 300+应用用, 覆盖核心心应用用 • 作为发布卡口口50+应用用 • 沉淀用用例例60000+ • 整体通过率96%+ e t s e T o rH e m e t s e T o rH e m
33. e t s e T o H r e m 延伸领域 e s e T H r te m o e t s e T o rH e m
34. 延伸领域 e • 压测数据生生成 om H r e t s e • T 故障模拟测试 • 故障定位 e t s e T o rH e m e t s e T o rH e m
35. e t s e T o H r e m e t s e T o rH e m e t s e T o rH e m
36. e t s e T o H r e m •JVM-Sandbox官方方群(各种大大神出没) e t s e T o rH e m e t s e T o rH e m
37. e t s e T o H r e m e t s e T o rH e m e t s e T o rH e m

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.129.0. UTC+08:00, 2024-07-04 13:13
浙ICP备14020137号-1 $Map of visitor$