Scala Test-Driven Development

Gaurav Sood

  • 出版商: Packt Publishing
  • 出版日期: 2016-10-28
  • 售價: $1,680
  • 貴賓價: 9.5$1,596
  • 語言: 英文
  • 頁數: 266
  • 裝訂: Paperback
  • ISBN: 1786464675
  • ISBN-13: 9781786464675
  • 相關分類: JVM 語言TDD 測試導向開發
  • 下單後立即進貨 (約3~4週)

商品描述

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.

商品描述(中文翻譯)

使用測試驅動開發(TDD)的基本原則,建立堅固的Scala應用程式,並將其納入您的工作流程中。

關於本書:
- 深入了解各種測試概念,如測試驅動開發(TDD)和行為驅動開發(BDD)。
- 高效使用內建的Scala功能,如ScalaTest、specs2和Scala Check。
- 改變解決問題的方式,專注於問題的邊界和定義,而非解決方案。

本書適合對Scala開發有興趣的開發人員,希望撰寫更高品質且易於維護的程式碼。不需要先備的TDD/BDD知識。

您將學到:
- 瞭解TDD的基礎知識及其重要性。
- 重構測試以建立API,以增加測試覆蓋率。
- 如何利用內建的Scala測試模組,如ScalaTest、specs2和Scala Check。
- 撰寫測試固定裝置並應用BDD的概念。
- 如何將測試分割為在持續交付週期的不同點運行。
- 重構的好處以及它如何影響所產生的程式碼的最終品質。
- 瞭解基於SBT的建置環境以及如何使用它來運行測試。
- Scala中模擬和存根的基本原則以及如何有效使用它們。

詳細內容:
測試驅動開發(TDD)比傳統方法更快地產生高品質的應用程式。由於TDD的系統性,應用程式在設計階段就進行了單獨單元和累計測試,以確保最佳性能和減少調試成本。

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

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

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

本書還介紹了其他工具,讓您能夠撰寫更高品質且易於維護的程式碼,並觀察您的應用程式變得更好。

風格和方法:
這本逐步指南通過各種實際示例解釋了TDD在Scala中的重要性。您將在本書的過程中學習撰寫完整的測試驅動應用程式。