Mastering Unit Testing Using Mockito and JUnit
暫譯: 掌握使用 Mockito 和 JUnit 的單元測試
Sujoy Acharya
- 出版商: Packt Publishing
- 出版日期: 2014-07-15
- 售價: $1,970
- 貴賓價: 9.5 折 $1,872
- 語言: 英文
- 頁數: 310
- 裝訂: Paperback
- ISBN: 1783982500
- ISBN-13: 9781783982509
-
相關分類:
Java 相關技術、JUnit、軟體測試、Unit Test 單元測試
海外代購書籍(需單獨結帳)
相關主題
商品描述
About This Book
- Create meaningful and maintainable automated unit tests using advanced JUnit features and the Mockito framework
- Build an automated continuous integration environment to get real-time feedback on broken code, code coverage, code quality, and integration issues
- Covers best practices and presents insights on architecture and designs to create faster and reliable unit testing environments
Who This Book Is For
This book is for you if you are a developer with some experience in Java application development as well as a basic knowledge of JUnit testing. But for those whose skill set is void of any prior experience with JUnit testing, the book also covers basic fundamentals to get you acquainted with the concepts before putting them into practise.
What You Will Learn
- Write advanced JUnit test cases using advanced JUnit 4 features
- Automate JUnit test cases using Gradle, Maven, and Ant scripting
- Practice continuous integration with Jenkins and Ant, Maven, and Gradle scripting
- Monitor code quality with the SonarQube dashboard
- Analyze static code using PMD, Checkstyle, and FindBugs
- Master code coverage with Clover, Cobertura, EclEmma, and JaCoCo
- Design for testability and refactor legacy code
- Practice test-driven development with Mockito
In Detail
It is insanity to keep doing things the same way and expect them to improve. Any program is useful only when it is functional; hence, before applying complex tools, patterns, or APIs to your production code, checking software functionality is must. Automated JUnit tests help you verify your assumptions continuously, detect side effects quickly, and also help you save time.
This book will provide the skills you need to successfully build and maintain meaningful JUnit test cases. You will begin with how to use advanced JUnit 4 features, improve code coverage, automate JUnit tests, monitor code quality, write JUnit tests for the database and web tier refactor legacy code, mock external dependencies using Mockito, and write testable code using test-driven development. By sequentially working through the steps in each chapter, you will quickly master the advanced JUnit features.
商品描述(中文翻譯)
進階單元測試精通指南:使用 Mockito 和 JUnit
本書介紹
- 使用進階 JUnit 功能和 Mockito 框架創建有意義且可維護的自動化單元測試
- 建立自動化持續整合環境,以獲得有關程式碼錯誤、程式碼覆蓋率、程式碼品質和整合問題的即時反饋
- 涵蓋最佳實踐並提供架構和設計的見解,以創建更快速且可靠的單元測試環境
本書適合誰
如果您是一位具有 Java 應用程式開發經驗的開發人員,並且對 JUnit 測試有基本了解,那麼這本書適合您。但對於那些在 JUnit 測試方面沒有任何先前經驗的讀者,本書也涵蓋了基本的基礎知識,以幫助您在實踐之前熟悉這些概念。
您將學到什麼
- 使用進階 JUnit 4 功能編寫進階 JUnit 測試案例
- 使用 Gradle、Maven 和 Ant 腳本自動化 JUnit 測試案例
- 使用 Jenkins 和 Ant、Maven、Gradle 腳本實踐持續整合
- 使用 SonarQube 儀表板監控程式碼品質
- 使用 PMD、Checkstyle 和 FindBugs 分析靜態程式碼
- 精通使用 Clover、Cobertura、EclEmma 和 JaCoCo 的程式碼覆蓋率
- 設計可測試性並重構舊有程式碼
- 使用 Mockito 實踐測試驅動開發
詳細內容
持續以相同方式做事並期望改善是瘋狂的。任何程式只有在功能正常時才有用;因此,在將複雜的工具、模式或 API 應用於您的生產程式碼之前,檢查軟體功能是必須的。自動化的 JUnit 測試幫助您持續驗證假設、快速檢測副作用,並幫助您節省時間。
本書將提供您成功構建和維護有意義的 JUnit 測試案例所需的技能。您將從如何使用進階 JUnit 4 功能開始,改善程式碼覆蓋率,自動化 JUnit 測試,監控程式碼品質,為資料庫和網頁層編寫 JUnit 測試,重構舊有程式碼,使用 Mockito 模擬外部依賴,並使用測試驅動開發編寫可測試的程式碼。通過逐步完成每一章的步驟,您將迅速掌握進階 JUnit 功能。