Effective Testing with RSpec 3: Build Ruby Apps with Confidence

Myron Marston, Ian Dees

  • 出版商: Pragmatic Bookshelf
  • 出版日期: 2017-10-03
  • 定價: $1,140
  • 售價: 9.0$1,026
  • 語言: 英文
  • 頁數: 356
  • 裝訂: Paperback
  • ISBN: 1680501984
  • ISBN-13: 9781680501988
  • 相關分類: Ruby
  • 立即出貨 (庫存 < 3)

買這商品的人也買了...

商品描述

Build and maintain quality software with RSpec, the popular BDD-flavored Ruby testing framework. This definitive guide from RSpec's lead developer shows you how to use RSpec to drive more maintainable designs, specify and document expected behavior, and prevent regressions during refactoring. Build a project using RSpec to design, describe, and test the behavior of your code-whether you're new to testing tools or an experienced developer.

RSpec has been downloaded more than 40 million times. Find out how to use this influential Ruby testing framework to iteratively develop a project with the confidence that comes from well-tested code. Effective Testing With RSpec 3 guides you through developing a Ruby project with RSpec, and then explores the individual components in more detail.

First, learn the basics of installing and using RSpec. Then, build a real-world JSON API, using RSpec throughout the process to drive a BDD-style outside-in workflow. Apply an effective test strategy to write fast, robust tests that support evolutionary design through refactoring. The rest of the book provides the definitive guide to RSpec's components. Use RSpec::Core's metadata to slice and dice your spec suite in flexible ways. Dig into RSpec::Expectation's matchers, which can be composed in flexible ways to precisely specify expected outcomes and get good failure messages that help you quickly diagnose the problem. Write fast, isolated tests with RSpec::Mocks test doubles while pushing your code toward simpler interfaces.

The authors, with a combined 20 years of automated testing experience, share useful, actionable testing advice that will help you have a fun, productive testing experience.

What You Need:

To follow along with the book, you'll need Ruby 2.1+. The book will guide you through installing RSpec 3 and setting up a new project to use it.

商品描述(中文翻譯)

使用 RSpec,這個受歡迎的 BDD 風格的 Ruby 測試框架,來建立和維護高品質的軟體。這本由 RSpec 的首席開發者撰寫的權威指南,將向您展示如何使用 RSpec 來推動更易維護的設計、指定和記錄預期行為,以及在重構過程中防止回歸。使用 RSpec 建立一個專案,來設計、描述和測試您的程式碼行為,無論您是測試工具的新手還是有經驗的開發者。

RSpec 已經被下載超過 4000 萬次。了解如何使用這個有影響力的 Ruby 測試框架,以迭代方式開發專案,並擁有經過良好測試的程式碼所帶來的信心。《Effective Testing With RSpec 3》將引導您使用 RSpec 開發一個 Ruby 專案,並深入探討各個組件的細節。

首先,學習安裝和使用 RSpec 的基礎知識。然後,使用 RSpec 在整個過程中驅動一個真實的 JSON API,以 BDD 風格的外部-內部工作流程進行開發。應用一個有效的測試策略,撰寫快速、強健的測試,支持通過重構進行演進式設計。本書的其餘部分提供了 RSpec 各個組件的權威指南。使用 RSpec::Core 的元數據在靈活的方式下切割和分析您的測試套件。深入研究 RSpec::Expectation 的匹配器,可以以靈活的方式組合,精確指定預期結果並獲得有助於快速診斷問題的良好錯誤訊息。使用 RSpec::Mocks 測試雙倍體來撰寫快速、隔離的測試,同時將您的程式碼推向更簡單的介面。

作者們擁有共同 20 年的自動化測試經驗,分享了有用的、可操作的測試建議,將幫助您擁有一個有趣、高效的測試體驗。

您需要的東西:
為了跟隨本書,您需要 Ruby 2.1+。本書將指導您安裝 RSpec 3,並設定一個新專案來使用它。