Testing with Junit (使用 Junit 進行測試)

Frank Appel

  • 出版商: Packt Publishing
  • 出版日期: 2015-08-29
  • 售價: $1,240
  • 貴賓價: 9.5$1,178
  • 語言: 英文
  • 頁數: 160
  • 裝訂: Paperback
  • ISBN: 1782166602
  • ISBN-13: 9781782166603
  • 相關分類: Java 相關技術JUnit
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

Master high quality software development driven by unit tests

About This Book

  • Design and implement robust system components by means of the de facto unit testing standard in Java
  • Reduce defect rate and maintenance effort, plus simultaneously increase code quality and development pace
  • Follow a step-by-step tutorial imparting the essential techniques based on real-world scenarios and code walkthroughs

Who This Book Is For

No matter what your specific background as a Java developer, whether you're simply interested in building up a safety net to reduce regressions of your desktop application or in improving your server-side reliability based on robust and reusable components, unit testing is the way to go. This book provides you with a comprehensive but concise entrance advancing your knowledge step-wise to a professional level.

What You Will Learn

  • Organize your test infrastructure and resources reasonably
  • Understand and write well structured tests
  • Decompose your requirements into small and independently testable units
  • Increase your testing efficiency with on-the-fly generated stand-in components and deal with the particularities of exceptional flow
  • Employ runners to adjust to specific test demands
  • Use rules to increase testing safety and reduce boilerplate
  • Use third party supplements to improve the expressiveness of your verification statements

In Detail

JUnit has matured to become the most important tool when it comes to automated developer tests in Java. Supported by all IDEs and build systems, it empowers programmers to deliver software features reliably and efficiently. However, writing good unit tests is a skill that needs to be learned; otherwise it's all too easy to end up in gridlocked development due to messed up production and testing code. Acquiring the best practices for unit testing will help you to prevent such problems and lead your projects to success with respect to quality and costs.

This book explains JUnit concepts and best practices applied to the test first approach, a foundation for high quality Java components delivered in time and budget.

From the beginning you'll be guided continuously through a practically relevant example and pick up background knowledge and development techniques step by step. Starting with the basics of tests organization you'll soon comprehend the necessity of well structured tests and delve into the relationship of requirement decomposition and the many-faceted world of test double usage. In conjunction with third-party tools you'll be trained in writing your tests efficiently, adapt your test case environment to particular demands and increase the expressiveness of your verification statements. Finally, you'll experience continuous integration as the perfect complement to support short feedback cycles and quality related reports for your whole team.

The tutorial gives a profound entry point in the essentials of unit testing with JUnit and prepares you for test-related daily work challenges.

Style and approach

This is an intelligible tutorial based on an ongoing and non-trivial development example. Profound introductions of concepts and techniques are provided stepwise as the programming challenges evolve. This allows you to reproduce and practice the individual skills thoroughly.

商品描述(中文翻譯)

**掌握以單元測試驅動的高品質軟體開發**

## 本書介紹
- 透過 Java 的事實上單元測試標準設計和實現穩健的系統元件
- 降低缺陷率和維護工作量,同時提高程式碼品質和開發速度
- 按步驟進行的教程,傳授基於真實場景和程式碼逐步解析的基本技術

## 本書適合誰
無論您作為 Java 開發者的具體背景如何,無論您是單純希望建立一個安全網以減少桌面應用程式的回歸問題,還是希望基於穩健且可重用的元件來改善伺服器端的可靠性,單元測試都是最佳選擇。本書為您提供了一個全面但簡明的入門,逐步提升您的知識至專業水平。

## 您將學到什麼
- 合理組織您的測試基礎設施和資源
- 理解並撰寫結構良好的測試
- 將需求分解為小且可獨立測試的單元
- 利用即時生成的替代元件提高測試效率,並處理異常流程的特殊情況
- 使用執行器來調整特定的測試需求
- 使用規則來提高測試安全性並減少樣板程式碼
- 使用第三方補充工具來改善驗證語句的表達能力

## 詳細內容
JUnit 已經成熟為 Java 自動化開發者測試中最重要的工具。它受到所有 IDE 和建構系統的支持,使程式設計師能夠可靠且高效地交付軟體功能。然而,撰寫良好的單元測試是一項需要學習的技能;否則,因為生產和測試程式碼的混亂而導致的開發停滯將變得過於容易。獲得單元測試的最佳實踐將幫助您防止此類問題,並使您的專案在品質和成本方面取得成功。

本書解釋了 JUnit 概念和最佳實踐,並應用於測試優先的方法,這是按時和預算交付高品質 Java 元件的基礎。

從一開始,您將通過一個實際相關的範例持續獲得指導,並逐步掌握背景知識和開發技術。從測試組織的基本概念開始,您將很快理解結構良好的測試的必要性,並深入探討需求分解與多面向測試替代品使用之間的關係。結合第三方工具,您將學會高效撰寫測試,根據特定需求調整測試案例環境,並提高驗證語句的表達能力。最後,您將體驗到持續整合作為支持短回饋週期和品質相關報告的完美補充,為整個團隊提供支持。

本教程為您提供了 JUnit 單元測試基本要素的深入入門,並為您準備好面對與測試相關的日常工作挑戰。

## 風格與方法
這是一個基於持續且非平凡的開發範例的易懂教程。隨著程式設計挑戰的演變,逐步提供概念和技術的深入介紹。這使您能夠徹底重現和練習各項技能。