如何高效完成HarmonyOS分布式应用测试?|HDC2021技术分论坛

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}},{"type":"color","attrs":{"color":"#40A9FF","name":"blue"}}],"text":"作者:liuxun,HarmonyOS测试架构师","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"HarmonyOS是新一代的智能终端操作系统,给开发者提供了设备发现、设备连接、跨设备调用等丰富的分布式API。随着越来越多的开发者投入到HarmonyOS分布式应用开发,分布式应用如雨后春笋般涌现。然而分布式应用测试却面临质量差、效率低等挑战。HarmonyOS如何应对这些挑战?下面,让我们一探究竟!","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"一、分布式应用测试挑战","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"自HarmonyOS 2.0发布以来,开发者在测试和上架HarmonyOS分布式应用过程中遇到很多挑战和困难。总体可归纳为以下三点:","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"分布式应用上架测试通过率低:","attrs":{}},{"type":"text","text":"开发者提交上架的分布式应用基础质量较差。如图1所示,基础功能问题和UX显示问题占比率高达85%。","attrs":{}}]}]}],"attrs":{}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/14/14bf46e87688deeabdc3f5fb1d476769.webp","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"图1 HarmonyOS分布式应用上架问题分析","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"分布式应用测试效率低:","attrs":{}},{"type":"text","text":"分布式应用涉及多台设备协同时,由于没有统一的测试框架,使得分布式应用测试效率较低。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"安全隐私问题拦截难:","attrs":{}},{"type":"text","text":"分布式应用涉及多台设备协同时,由于缺乏全面且高效的隐私合规检测方案,安全隐私问题拦截难度较大。","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"鉴于以上HarmonyOS分布式应用测试面临的挑战,华为DevEco Testing提供了一套对HarmonyOS分布式应用测试解决方案,具体方案介绍如下。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"二、分布式应用测试解决方案","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"DevEco Testing是一款全新的HarmonyOS测试解决方案。如图2所示,是DevEco Testing测试能力全景视图,基于开发旅程不同阶段的测试活动,给开发者提供对应测试工具和测试服务能力。","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/1e/1ec8b34f71b6129a6cc0d64e48e4d775.webp","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"图2 DevEco Testing测试能力全景视图","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"基于分布式应用的关键特征及开发者面临的关键问题和挑战,DevEco Testing从测试标准、测试服务及云测服务三个方面提供分布式应用测试的解决方案。下面,我们将逐一介绍。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"1. 测试标准","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"测试标准定义APP的入门级测试要求,重点覆盖消费者用户最关心的HarmonyOS特征和体验指标。HarmonyOS提供了流转、兼容性、安全、性能、功耗、稳定性、游戏,共7项测试标准,帮助开发者快速上手HarmonyOS分布式应用测试,如图3所示。 ","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/25/25838d9c80b134ad768e991636482039.webp","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"图3 测试标准范围定义","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"目前,测试标准已经上线HarmonyOS应用开发者官网测试专区,建议开发者上架HarmonyOS分布式应用前参照该测试标准进行自检和测试,可以有效提升上架效率。 ","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"测试标准官网文档链接:","attrs":{}},{"type":"link","attrs":{"href":"https://developer.harmonyos.com/cn/docs/documentation/doc-guides/app-performance-testing-0000001182393201","title":"","type":null},"content":[{"type":"text","text":"https://developer.harmonyos.com/cn/docs/documentation/doc-guides/app-performance-testing-0000001182393201","attrs":{}}]}]},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"2. 测试服务","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"测试服务给开发者提供全面且高效的自动化测试方案,目的是帮助开发者提升测试质量和测试效率。目前DevEco Studio3.1 Beta已集成了","attrs":{}},{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"单元测试框架、分布式UI测试框架、评分工具、远程真机/远程模拟器及云测平台接入Portal共5项测试服务","attrs":{}},{"type":"text","text":",详见图2。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"针对分布式应用测试面临的挑战,我们接下来将重点介绍分布式UI测试框架和评分工具。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"(1)分布式UI测试框架","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"分布式UI测试框架,定位于解决HarmonyOS分布式应用UI自动化测试及测试效率问题。主要包含以下特性:","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"① 提供30+测试API,覆盖控件查找、控件操作、按键注入等,并支持基础的分布式UI自动化测试,如:findComponent, getText等。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"② 提供远程和本地描述方式一致的分布式持测试API,仅参数不同,使用简单方便。通过UIDriver来实现。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"③ 分布式UI测试框架集成于IDE,开发者一键式开展自动化测试执行。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"分布式UI测试框架详细的使用教程请访问官网链接:","attrs":{}},{"type":"link","attrs":{"href":"https://developer.harmonyos.com/cn/docs/documentation/doc-guides/distributed-uitest-framework-0000001152756178","title":"","type":null},"content":[{"type":"text","text":"https://developer.harmonyos.com/cn/docs/documentation/doc-guides/distributed-uitest-framework-0000001152756178","attrs":{}}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"接下来,我们通过“亲子早教系统中的分布式拼图游戏”案例,演示分布式UI测试框架的操作流程,包含对分布式FA测试用例编写、分布式测试API使用、分布式UI自动化用例执行过程以及测试结果检查。","attrs":{}}]},{"type":"video","attrs":{"videoHTML":""}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"(2)HarmonyOS分布式应用评分工具","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"HarmonyOS分布式应用评分工具定位于帮助开发者本地快速测试,快速闭环问题,如图4所示。","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/c2/c24b702bba3f78f7a1c91f08d4bbf663.webp","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"图4 评分工具","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"评分工具主要包含以下特性:","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"本地速测,无需编写用例","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"支持兼容性/设计约束/UX/性能/稳定性测试","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"支持源码级测试能力","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"已支持24个检测项,执行时长<5分钟","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"集成于DevEco Studio3.1 Beta版本","attrs":{}}]}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":5},"content":[{"type":"text","text":"3. 云测服务","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"云测服务包含兼容性、安全、UX、性能、功耗、稳定性6项测试能力,支持流转、服务卡片等HarmonyOS关键特征自动化测试,同时还支持华为1+8多设备运行,帮助开发者全方位看护APP基础质量。针对分布式应用测试面临的挑战,接下来重点介绍UX测试服务以及安全测试服务。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"(1)UX测试服务","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"前面已经介绍过,HarmonyOS应用上架过程中UX问题占比很高,尤其在折叠屏、PAD等设备上文字截断、布局错乱等问题较为突出。为此,HarmonyOS提供全新的UX测试服务,聚焦UX平台规范满足度以及UI显示异常故障检测,并支持在华为1+8设备上覆用。检测能力如图5所示。","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/0f/0f5f2f31c14cea54c7ded7fa5e832c98.jpeg","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"图5 检测能力概览","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"UX平台规范是指HarmonyOS通用的UX平台规范,如:流转图标规范,可以在HarmonyOS应用开发者官网获取到。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong","attrs":{}}],"text":"(2)安全测试服务","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"安全测试服务包括隐私合规和漏洞检测两大部分。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"隐私合规检测能力对标“国际”、“国内隐私法规”及“行业规范”进行构建,主要定位于帮助开发者识别隐私违规的问题,减少因隐私问题导致的应用下线。检测能力包括公开透明、最小化、权限合规等6个大类,已支持20+自动检测能力,能较好的覆盖隐私设计原则。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"目前,隐私合规自动化测试存在功能场景自动化遍历、敏感数据提取和敏感行为检测、隐私声明一致性分析等关键技术难点,测试成本高,难度大,HarmonyOS通过如下测试技术,能有效解决检测自动化率和准确率的问题,处于业界领先。","attrs":{}}]},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"AI自动遍历技术,提升界面遍历深度和广度。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"OCR文本识别技术,提取UX界面的文字,识别隐私声明。 ","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"NLP语义分析技术,提取隐私敏感数据描述。","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"动态沙箱仿真技术,构建敏感操作(如:改变位置信息模拟)的模拟能力。","attrs":{}}]}]}],"attrs":{}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"安全漏洞检测能力基于HarmonyOS安全管理要求进行构建,主要定位于识别并构建Ability安全、权限安全、加密安全、网络安全等8类漏洞检测能力,目前已经覆盖60+漏洞扫描规则,能有效帮助开发者充分识别漏洞隐患,如图6所示。","attrs":{}}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/a7/a7911784f385cc2a92c9640c7631297a.webp","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","marks":[{"type":"size","attrs":{"size":10}}],"text":"图6 安全漏洞检测","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"接下来,我们通过视频给大家展示一下云测服务使用过程,包括测试工程创建、测试任务创建和测试结果展示,以便更好的了解和使用云测服务。","attrs":{}}]},{"type":"video","attrs":{"videoHTML":""}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"以上就是本期的全部内容!欢迎大家使用DevEco Testing测试服务,并给我们提出宝贵意见。","attrs":{}}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章