CI/CD 中的測試策略:讓每次部署都有品質保障
分享如何在 CI/CD 管線中規劃測試策略,從 commit 到 deploy 每個階段該跑什麼測試、怎麼設定品質關卡。
本文以 GitHub Actions 為範例,其他 CI/CD 工具的設定方式可能不同。
為什麼 CI/CD 需要 QA?
Stage 1:Commit 階段(每次 push 觸發)
-
›
靜態分析
ESLint、Pylint、SonarQube
-
›
單元測試
快速、獨立、無外部依賴
-
›
程式碼覆蓋率
設定最低門檻(例如 80%)
Stage 2:整合測試階段
-
›
API 測試
驗證服務間的互動
-
›
資料庫測試
Migration、資料完整性
-
›
第三方服務 Mock
不依賴外部服務
Stage 3:E2E 測試階段
-
›
核心流程測試
登入、購買、支付等關鍵路徑
-
›
跨瀏覽器測試
Chrome、Firefox、Safari
-
›
視覺回歸測試
Percy、Chromatic
Stage 4:部署前關卡
-
›
效能測試
確保沒有效能退化
-
›
安全掃描
OWASP ZAP、Snyk
-
›
人工審核
需要時的手動 approval
品質關卡(Quality Gate)設定
常見的 CI/CD 測試陷阱
-
›
測試太慢
把慢的測試移到非阻塞的 nightly build
-
›
Flaky Test
不穩定的測試要馬上修或隔離,否則團隊會習慣忽略紅燈
-
›
環境不一致
用 Docker 確保 CI 環境和 production 一致
-
›
只測快樂路徑
負面測試和邊界情況一樣重要
How to choose a test automation framework: Selenium vs Cypress vs Playwright complete comparison
Test Automation Framework Selection Guide - An in-depth comparison of the advantages, disadvantages and applicable scenarios of Selenium, Cypress, and Playwright to help you choose the most suitable framework from the perspective of team technology stack and maintenance costs.
QA 工程師的一天:從手動測試到自動化的完整流程
分享 QA 工程師的日常工作,從需求分析、測試案例設計、手動測試執行到自動化測試導入的完整經驗。
Shift-Left Testing Strategy: A practical method to find bugs earlier and at lower cost
Shift-Left Testing Strategy Practice Guide - Advance testing to the early stages of development, covering requirements review, TDD, static analysis, Code Review and other methods to fundamentally reduce software defects and repair costs
General Disclaimer
The information provided on this site is for reference only. We do not guarantee its completeness or accuracy. Users should determine the applicability of the information on their own.