用5W1H告訴你如何規劃合理的測試策略

{"type":"doc","content":[{"type":"blockquote","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}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"本文分享自華爲雲社區","attrs":{}},{"type":"link","attrs":{"href":"https://bbs.huaweicloud.com/blogs/286096?utm_source=infoq&utm_medium=bbs-ex&utm_campaign=developer&utm_content=content","title":"","type":null},"content":[{"type":"text","text":"《淺談敏捷開發的測試策略》","attrs":{}}]},{"type":"text","text":",作者:敏捷江湖桃花島梅師姐 。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"前言","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"隨着敏捷和DevOps的出現,改變了傳統的軟件開發模式,與此同時測試也面臨着不小的挑戰,在敏捷開發模式下,短週期迭代交付模式意味着時間變短,擁抱變化意味着變更頻繁,用戶故事描述需求的方式意味着文檔變少,全功能團隊中意味着專門的測試人員變少。基於這樣的情況,如何讓測試也變得敏捷,做好測試工作呢?今天我們就一起聊一下如何做好敏捷開發的測試策略。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"敏捷開發測試策略","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"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}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我們可以按照測試的目的、範圍、起止時間、人員安排、工具,即5W1H法來規劃合理的測試策略。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"why:爲什麼要進行測試,測試的目的是什麼?","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"what:測試的內容及範圍,測哪些,確定測試重點(RBT基於需求的測試等)","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"when:測試的起止時間,考慮影響時間的因素","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"where:相關文檔的存放位置、缺陷的存放、環境地質","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"who :測試人員的安排","attrs":{}}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"how:選用何種測試工具及方法進行測試","attrs":{}}]}]}],"attrs":{}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"Why","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"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}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"What","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"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}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/7e/7e5b0520f7faacbfef98f2fc6ec7ecb9.png","alt":"圖1 測試四象限","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖1 測試四象限","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"依據敏捷的分層計劃原則,測試測試也採用不同級別的測試,可以參考Epic-Feature-Story-Task制定策略。下面可以作爲制定策略的參考,業務和產品大多是不相同的,可以根據自己業務和產品的特點進行調整。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"敏捷開發過程是由迭代組成的,Epic是由若干個迭代完成,通常爲集成測試和端到端的測試;Feature通常若干迭代來實現,通常會進行特性測試、功能測試、UAT、場景測試;Story通常在迭代內完成,通常進行功能測試、用戶故事測試;Task爲迭代內的測試,通常進行單元測試、模塊測試、代碼質量測試。其中性能測試會覆蓋到Story、Feature和Epic層級。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"When","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"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}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/3e/3ea6f3beaab55e3b429692cb4645ee3a.png","alt":"圖2 瀑布開發模式","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖2 瀑布開發模式","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在敏捷開發模式下,測試不只是一個階段,而是一個活動,每個Sprint都有測試活動。每個迭代都會進行單元測試、代碼質量測試、用戶故事測試、特性和能力驗收測試;從Sprint2開始都要進行一次Sprint級別的迴歸測試,以自動化測試的形式實現。累積了幾個迭代之後,在發佈前要進行端到端的集成測試。如下圖所示。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/c2/c2b4841dc488e673210b5c3407a2e70a.png","alt":"圖3 Sprint測試活動","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖3 Sprint測試活動","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"Where","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"儘管敏捷開發中採用輕文檔的形式,但同樣也要做好相關文檔的管理。在測試初始要約定相關測試交付物的管理和存放形式,包括不限於測試策略、測試工件、缺陷、測試數據、虛擬服務和自動化腳本等。通常會在項目管理工具中進行管理,和開發的工作項之間建立關聯,這樣便於後續進行追溯和查看。以","attrs":{}},{"type":"link","attrs":{"href":"https://www.huaweicloud.com/devcloud/","title":"","type":null},"content":[{"type":"text","text":"華爲雲DevCloud","attrs":{}}]},{"type":"text","text":"爲例,可以將文檔上傳到【Wiki】和【文檔】中,然後在工作項中建立關聯。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/1a/1a92a5048286108e4797a064499ecd01.jpeg","alt":"圖4 華爲雲DevCloud示例","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖4 華爲雲DevCloud示例","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"Who","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"敏捷開發中,測試活動爲團隊的共同工作,而不僅僅是測試人員。其中開發人員做好TDD、單元測試和代碼質量測試,同時因爲接口測試涉及到接口間的數據交換、傳遞和控制管理等內部邏輯的問題,也建議由開發人員進行。測試人員包括迭代內的測試人員和跨迭代的技術人員。迭代內的測試人員主要負責迭代測試的設計和執行,包括探索性測試和API、UI測試自動化腳本的開發和執行,還有自動化的迴歸冒煙測試。跨迭代的測試人員更多專注在協調測試和制定自動化測試策略。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"同時,測試人員爲團隊中的一員,不僅僅執行測試工作,還要參與測試計劃、評估和工作安排、回顧及任何其他團隊活動。","attrs":{}}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"How","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"爲了能夠更好的配合敏捷開發的小步快跑、儘早交付的模式,測試就需要具備快速測試和及早反饋的能力。在敏捷方法緊迫時間的框架下,自動化測試能力必不可少,這樣可以極大的緩解測試的壓力。根據Mike Cohn的","attrs":{}},{"type":"link","attrs":{"href":"https://bbs.huaweicloud.com/blogs/245621","title":"","type":null},"content":[{"type":"text","text":"測試金字塔","attrs":{}}]},{"type":"text","text":",自動化測試的比例分配爲7:2:1,即單元測試佔70%,接口測試佔20%,UI測試佔10%,這樣實現分層自動化。在自動化的基礎上還要進行手工的探索性測試。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/8b/8b83b2f70845bbae0fa10893fe5ef5b9.png","alt":"圖5 測試金字塔","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖5 測試金字塔","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"現在有很多的自動化工具可選,開源工具如UI層的appium、Cucumber、Protractor,API層的POSTMAN、數據庫層的DbFit;商業工具如UI層的IBM RFT、LeanFT, API層的SmartBear等。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"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}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"測試策略示例","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"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}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/f7/f783e41ef8d0ceae602d2f2edcfd10ef.png","alt":"圖6 敏捷開發","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖6 敏捷開發","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"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}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/44/44ebc1ad41538215b4fa9d3986f49431.png","alt":"圖7 測試策略示例","title":null,"style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"圖7 測試策略示例","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"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}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"後記","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"上面給出了制定測試策略的5W1H可以作爲參考,最重要的是要牢記測試的目的是爲了預防缺陷,幫助團隊構建最好的系統,交付給客戶有價值的產品。因此要把質量左移的測試策略作爲最重要的項目管理核心理念之一貫穿到整個軟件生命週期的交付中,通過缺陷預防將質量移向全生命週期的前端,通過制定基於風險的測試策略驅動,儘早發現重大缺陷。","attrs":{}}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https://bbs.huaweicloud.com/blogs?utm_source=infoq&utm_medium=bbs-ex&utm_campaign=developer&utm_content=content","title":"","type":null},"content":[{"type":"text","text":"點擊關注,第一時間瞭解華爲雲新鮮技術~","attrs":{}}]}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章