如何高效完成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":{}}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章