Mastering Unit Testing Using Mockito and JUnit
Sujoy Acharya
- 出版商: Packt Publishing
- 出版日期: 2014-07-15
- 售價: $1,940
- 貴賓價: 9.5 折 $1,843
- 語言: 英文
- 頁數: 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測試,監控代碼質量,為數據庫和Web層編寫JUnit測試,重構遺留代碼,使用Mockito模擬外部依賴,以及使用測試驅動開發編寫可測試代碼。通過按照每章中的步驟逐步進行,您將迅速掌握高級JUnit功能。