Skip to Content
持續交付|使用Java
book

持續交付|使用Java

by Daniel Bryant, Abraham Marín-Pérez
July 2019
Intermediate to advanced
480 pages
9h 35m
Chinese
GoTop Information, Inc.
Content preview from 持續交付|使用Java
功能測試:正確性與驗收 |
315
你要根據你使用的技術以及你連接的元件類型來決定做這件事的機制。Feature Flags
服務的
FlagRepositoryIT
類別有一個這種範例。在Feature Flags 服務中(資料夾
/
featureflags
),與資料庫的所有通訊都被封裝在
FlagRepository
類別裡面,這個類別提
供一個高階的介面供持久層使用。我們藉著實例化這個類別,並將它連到真正的資料庫
來驗證所有的操作。啟動真正的資料庫比想像中容易:拜 Docker 之賜,現在大部分的
資料庫供應商都有提供內含資料庫的容器。你可以使用它與 Docker Maven 來建立並啟
動真正的資料庫,接著執行整合測試,並且在完成時丟棄它,詳情見 Feature Flags 服務
pom.xml
檔。
測試容錯力
有時執行整合測試是為了驗證 app 在遇到錯誤時有正確的回應。這在端對端測試層級不
可能做到,因為你無法控制外部元件。你或許可以在元件或驗收測試中嘗試這件事,
因為在這些測試中,你可以使用可控制的測試替身,但是,因為這些測試有許多變動因
素,你可能會難以評估系統有沒有按預期動作。
但是,如果你將與外部元件聯繫的類別隔離,並用各種失敗的情況測試它,你就可以肯
定那個類別會有什麼反應,進而推論服務其他的部分會有什麼行為。
測試容錯力與驗證外部互動不一樣:在測試外部互動時,你要使用真正的元件(或盡量
擬真的東西)來合理地測試交易,但是在測試容錯力時,你要使用假元件,以產生各種
不同的錯誤情況。我們已經談過進行這種測試所需的技術了 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精實企業|高績效組織如何達成創新規模化

精實企業|高績效組織如何達成創新規模化

Jez Humble, Joanne Molesky, Barry O'Reilly
管理Kubernetes

管理Kubernetes

Brendan Burns, Craig Tracey
精通機器學習|使用Python

精通機器學習|使用Python

Sarah Guido, Andreas C. Mueller
数字化转型:企业破局的34 个锦囊

数字化转型:企业破局的34 个锦囊

Gary O’Brien, Xiao Guo, Mike Mason

Publisher Resources

ISBN: 9789865021740