Mockito Essentials
暫譯: Mockito 基礎精要
Sujoy Acharya
- 出版商: Packt Publishing
- 出版日期: 2014-10-24
- 售價: $1,470
- 貴賓價: 9.5 折 $1,397
- 語言: 英文
- 頁數: 214
- 裝訂: Paperback
- ISBN: 1783983604
- ISBN-13: 9781783983605
海外代購書籍(需單獨結帳)
商品描述
About This Book
- Explore Mockito features and learn stubbing, mocking and spying dependencies using the Mockito framework
- Mock external dependencies for legacy and greenfield projects and create an automated JUnit safety net for building reliable, maintainable and testable software
- A focused guide filled with examples and supporting illustrations on testing your software using Mockito
Who This Book Is For
This book is ideal for developers who have some experience in Java application development as well as some basic knowledge of test doubles and JUnit testing. This book also introduces you to the fundamentals of JUnit testing, test doubles, refactoring legacy code, and writing JUnit tests for GWT and web services.
What You Will Learn
- Explore test doubles and work with dummy, spy, fake, stub, and mock objects
- Uncover the Mockito architecture and build a custom mocking framework
- Mock, stub, and spy external code dependencies using Mockito
- Practice Behavior-driven Development (BDD) with Mockito
- Make legacy code testable by mocking and spying dependencies
- Mock GWT and web service dependencies using Mockito
- Discover argument captors, inline stubbing, and resetting mock objects
In Detail
Whether you are new to JUnit testing and mocking or a seasoned Mockito expert, this book will provide you with the skills you need to successfully build and maintain meaningful JUnit test cases and effectively mock external dependencies. At the beginning, this book deals with dummy and fake objects and then moves on to exploring stubs followed by an example on spying. Then, it will show you how to make legacy code testable, mock external dependencies using Mockito, and write testable code for greenfield projects. You will also gain an insight on the concepts of Service-oriented Architecture (SOA) as well as understand how to unit test RESTful web services with Mockito. By sequentially working through the steps in each chapter, you will quickly learn the features of Mockito.
Mockito Essentials will ensure your success with these concepts, tools, and frameworks.
商品描述(中文翻譯)
使用 Mockito 進行單元測試的實用指南
本書介紹
- 探索 Mockito 的功能,學習如何使用 Mockito 框架進行依賴的存根、模擬和間諜測試
- 為舊系統和新專案模擬外部依賴,並創建自動化的 JUnit 安全網,以構建可靠、可維護和可測試的軟體
- 一本專注的指南,充滿示例和支持插圖,幫助您使用 Mockito 測試軟體
本書適合誰
本書非常適合具有一定 Java 應用程式開發經驗的開發人員,以及對測試替身和 JUnit 測試有基本了解的人。本書還將介紹 JUnit 測試、測試替身、重構舊代碼的基本原理,以及為 GWT 和網路服務編寫 JUnit 測試。
您將學到什麼
- 探索測試替身,並使用虛擬物件、間諜、假物件、存根和模擬物件進行操作
- 揭示 Mockito 架構並構建自定義模擬框架
- 使用 Mockito 模擬、存根和間諜外部代碼依賴
- 使用 Mockito 實踐行為驅動開發 (BDD)
- 通過模擬和間諜依賴使舊代碼可測試
- 使用 Mockito 模擬 GWT 和網路服務依賴
- 發現參數捕獲器、內聯存根和重置模擬物件
詳細內容
無論您是 JUnit 測試和模擬的新手,還是經驗豐富的 Mockito 專家,本書將為您提供成功構建和維護有意義的 JUnit 測試案例以及有效模擬外部依賴所需的技能。本書一開始將處理虛擬物件和假物件,然後探索存根,接著是間諜的示例。接下來,它將向您展示如何使舊代碼可測試,使用 Mockito 模擬外部依賴,並為新專案編寫可測試的代碼。您還將深入了解面向服務架構 (SOA) 的概念,以及如何使用 Mockito 對 RESTful 網路服務進行單元測試。通過逐步完成每一章的步驟,您將迅速學會 Mockito 的特性。
Mockito Essentials 將確保您在這些概念、工具和框架上的成功。