RSpec Essentials (RSpec 基礎精要)
Mani Tadayon
- 出版商: Packt Publishing
- 出版日期: 2016-04-20
- 售價: $1,810
- 貴賓價: 9.5 折 $1,720
- 語言: 英文
- 頁數: 222
- 裝訂: Paperback
- ISBN: 1784395900
- ISBN-13: 9781784395902
海外代購書籍(需單獨結帳)
相關主題
商品描述
Key Features
- Explore the concept of testability and how to implement tests that deliver the most value
- Maximize the quality of your Ruby code through a wide variety of tests
- Master the real-world tradeoffs of testing through detailed examples supported by in-depth discussion
Book Description
This book will teach you how to use RSpec to write high-value tests for real-world code. We start with the key concepts of the unit and testability, followed by hands-on exploration of key features. From the beginning, we learn how to integrate tests into the overall development process to help create high-quality code, avoiding the dangers of testing for its own sake.
We build up sample applications and their corresponding tests step by step, from simple beginnings to more sophisticated versions that include databases and external web services. We devote three chapters to web applications with rich JavaScript user interfaces, building one from the ground up using behavior-driven development (BDD) and test-driven development (TDD).
The code examples are detailed enough to be realistic while simple enough to be easily understood. Testing concepts, development methodologies, and engineering tradeoffs are discussed in detail as they arise. This approach is designed to foster the reader's ability to make well-informed decisions on their own.
What you will learn
- Identify a unit of software for the purposes of testing
- Manage test states with hooks, fixtures, and mocks
- Handle external web services in tests using various techniques
- Configure RSpec flexibly and cleanly using support code and environment variables
- Interact with rich web apps in tests using Capybara
- Build the right feature with behavior-driven development
- Customize matchers and failure messages
- Verify correct development and production environments
About the Author
Mani Tadayon first learned to program as a shy 7th grader on an Apple IIe using BASIC. He went on to learn Pascal, C++, Java, JavaScript, Visual Basic, and PHP before becoming a Ruby developer in 2008. With 15 years of experience in the software industry, he has developed expertise in web development, infrastructure, and testing. Mani's interests and education are broad, with degrees in foreign languages, computer science, and geography. He lives just far enough from Silicon Valley with his family and their many, many Shiba Inus.
Table of Contents
- Exploring Testability from Unit Tests to Behavior-Driven Development
- Specifying Behavior with Examples and Matchers
- Taking Control of State with Doubles and Hooks
- Setting Up and Cleaning Up
- Simulating External Services
- Driving a Web Browser with Capybara
- Building an App from the Outside In with Behavior-Driven Development
- Tackling the Challenges of End-to-end Testing
- Configurability
- Odds and Ends
商品描述(中文翻譯)
關鍵特點
- 探索可測試性的概念以及如何實施能帶來最大價值的測試
- 通過各種測試最大化您的 Ruby 代碼質量
- 通過詳細的範例和深入的討論掌握測試的現實權衡
書籍描述
本書將教您如何使用 RSpec 為現實世界的代碼編寫高價值的測試。我們從單元和可測試性的關鍵概念開始,接著進行關鍵特性的實作探索。從一開始,我們學習如何將測試整合到整體開發過程中,以幫助創建高質量的代碼,避免為了測試而測試的危險。
我們逐步建立範例應用程式及其相應的測試,從簡單的開始到更複雜的版本,這些版本包括資料庫和外部網路服務。我們專門用三章來探討具有豐富 JavaScript 使用者介面的網路應用程式,從零開始使用行為驅動開發(BDD)和測試驅動開發(TDD)來構建一個應用程式。
代碼範例詳細到足以真實,但又簡單到易於理解。測試概念、開發方法論和工程權衡在出現時會詳細討論。這種方法旨在培養讀者獨立做出明智決策的能力。
您將學到的內容
- 確定測試目的的軟體單元
- 使用 hooks、fixtures 和 mocks 管理測試狀態
- 使用各種技術在測試中處理外部網路服務
- 使用支援代碼和環境變數靈活且乾淨地配置 RSpec
- 使用 Capybara 在測試中與豐富的網路應用互動
- 使用行為驅動開發構建正確的功能
- 自訂匹配器和失敗訊息
- 驗證正確的開發和生產環境
關於作者
Mani Tadayon 在 Apple IIe 上使用 BASIC 學習編程,當時他是一名害羞的七年級學生。他隨後學習了 Pascal、C++、Java、JavaScript、Visual Basic 和 PHP,並於 2008 年成為 Ruby 開發者。擁有 15 年的軟體行業經驗,他在網路開發、基礎設施和測試方面積累了專業知識。Mani 的興趣和教育背景廣泛,擁有外語、計算機科學和地理學位。他與家人及眾多柴犬住在距離矽谷不遠的地方。
目錄
1. 從單元測試到行為驅動開發探索可測試性
2. 使用範例和匹配器指定行為
3. 使用 Doubles 和 Hooks 控制狀態
4. 設置和清理
5. 模擬外部服務
6. 使用 Capybara 驅動網頁瀏覽器
7. 從外部開始構建應用程式,使用行為驅動開發
8. 解決端到端測試的挑戰
9. 可配置性
10. 雜項