Scala Test-Driven Development
暫譯: Scala 測試驅動開發

Gaurav Sood

  • 出版商: Packt Publishing
  • 出版日期: 2016-10-28
  • 售價: $1,830
  • 貴賓價: 9.5$1,739
  • 語言: 英文
  • 頁數: 266
  • 裝訂: Paperback
  • ISBN: 1786464675
  • ISBN-13: 9781786464675
  • 相關分類: JVM 語言TDD 測試導向開發
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

Build robust Scala applications by implementing the fundamentals of test-driven development in your workflow

About This Book

  • Get a deep understanding of various testing concepts such as test-driven development (TDD) and BDD
  • Efficient usage of the built-in Scala features such as ScalaTest, specs2, and Scala check
  • Change your approach towards problem solving by thinking about the boundaries of the problem and its definition rather than focusing on the solution

Who This Book Is For

This book is for Scala developers who are looking to write better quality and easily maintainable code. No previous knowledge of TDD/BDD is required.

What You Will Learn

  • Understand the basics of TDD and its significance
  • Refactoring tests to build APIs in order to increase test coverage
  • How to leverage the inbuilt Scala testing modules like ScalaTest, specs2 and Scala Check
  • Writing test fixtures and apply the concepts of BDD
  • How to divide tests to run at different points in continuous delivery cycle
  • Benefits of refactoring and how it affects the final quality of code produced
  • Understanding of SBT based build environment and how to use it to run tests
  • The fundamentals of mocking and stubbing in Scala and how to use it efficiently

In Detail

Test-driven development (TDD) produces high-quality applications in less time than is possible with traditional methods. Due to the systematic nature of TDD, the application is tested in individual units as well as cumulatively, right from the design stage, to ensure optimum performance and reduced debugging costs.

This step-by-step guide shows you how to use the principles of TDD and built-in Scala testing modules to write clean and fully tested Scala code and give your workflow the change it needs to let you create better applications than ever before.

After an introduction to TDD, you will learn the basics of ScalaTest, one of the most flexible and most popular testing tools around for Scala, by building your first fully test-driven application. Building on from that you will learn about the ScalaTest API and how to refactor code to produce high-quality applications.

We'll teach you the concepts of BDD (Behavior-driven development) and you'll see how to add functional tests to the existing suite of tests. You'll be introduced to the concepts of Mocks and Stubs and will learn to increase test coverage using properties.

With a concluding chapter on miscellaneous tools, this book will enable you to write better quality code that is easily maintainable and watch your apps change for the better.

Style and approach

This step-by-step guide explains the significance of TDD in Scala through various practical examples. You will learn to write a complete test-driven application throughout the course of the book.

商品描述(中文翻譯)

透過在工作流程中實施測試驅動開發的基本原則,構建穩健的 Scala 應用程式

本書簡介



  • 深入了解各種測試概念,如測試驅動開發 (TDD) 和行為驅動開發 (BDD)

  • 有效使用內建的 Scala 功能,如 ScalaTest、specs2 和 ScalaCheck

  • 改變解決問題的方式,專注於問題的邊界和定義,而不是僅僅關注解決方案

本書適合誰


本書適合希望撰寫更高品質且易於維護代碼的 Scala 開發者。不需要具備 TDD/BDD 的先前知識。

您將學到什麼



  • 理解 TDD 的基本概念及其重要性

  • 重構測試以構建 API,以增加測試覆蓋率

  • 如何利用內建的 Scala 測試模組,如 ScalaTest、specs2 和 ScalaCheck

  • 撰寫測試環境並應用 BDD 的概念

  • 如何將測試劃分為在持續交付週期中的不同階段運行

  • 重構的好處及其對最終代碼質量的影響

  • 理解基於 SBT 的構建環境及如何使用它來運行測試

  • Scala 中模擬和存根的基本原則及其高效使用方法

詳細內容


測試驅動開發 (TDD) 能在比傳統方法更短的時間內產生高品質的應用程式。由於 TDD 的系統性特質,應用程式從設計階段開始就進行單元測試和累積測試,以確保最佳性能並降低除錯成本。

這本逐步指南將向您展示如何使用 TDD 的原則和內建的 Scala 測試模組來撰寫乾淨且經過充分測試的 Scala 代碼,並為您的工作流程帶來所需的變化,讓您能夠創建比以往更好的應用程式。

在介紹 TDD 之後,您將通過構建第一個完全測試驅動的應用程式來學習 ScalaTest 的基本知識,這是 Scala 中最靈活和最受歡迎的測試工具之一。在此基礎上,您將學習 ScalaTest API 以及如何重構代碼以產生高品質的應用程式。

我們將教您 BDD(行為驅動開發)的概念,並展示如何將功能測試添加到現有的測試套件中。您將接觸到模擬(Mocks)和存根(Stubs)的概念,並學習如何使用屬性來增加測試覆蓋率。

在結尾章節中介紹各種工具,本書將使您能夠撰寫更高品質且易於維護的代碼,並見證您的應用程式變得更好。

風格與方法


這本逐步指南通過各種實用範例解釋 TDD 在 Scala 中的重要性。您將在本書的過程中學會撰寫完整的測試驅動應用程式。