Hands-On Test-Driven Development: Using Ruby, Ruby on Rails, and Rspec (Paperback) (實作導向的測試驅動開發:使用 Ruby、Ruby on Rails 和 Rspec)
Donald, Greg
- 出版商: Apress
- 出版日期: 2023-12-13
- 售價: $2,300
- 貴賓價: 9.5 折 $2,185
- 語言: 英文
- 頁數: 232
- 裝訂: Quality Paper - also called trade paper
- ISBN: 1484297474
- ISBN-13: 9781484297476
-
相關分類:
Ruby、TDD 測試導向開發
立即出貨 (庫存 < 3)
買這商品的人也買了...
相關主題
商品描述
Learn to properly test Ruby and Ruby on Rails applications by first writing failing tests, and then by implementing application code to make the failing tests pass. This book will teach you how to employ test-driven development (TDD) using RSpec while building a blog from start to finish. By the end of the book, you will be ready to deploy their fully tested blog to their own production web server using the latest versions of Ruby 3 and Ruby on Rails 7.
The biggest challenge with learning and becoming comfortable with test-driven development is that software engineers often cannot imagine what writing a failing test looks like in practice. They write their implementation code first, and only then think about writing tests around their implementation code. This leads to tests that pass by accident, or tests that do not actually test anything. This book will give you the confidence to write tests in the RSpec domain-specific language. You will see your tests fail "properly" before proceeding with writing any implementation code to get them to pass.
This book covers the latest techniques for writing RSpec tests, including "system" specs, and the often overlooked "view" specs, and how to integrate RSpec with other tools like Capybara, headless Chrome, and the new web driver gem. It also covers FactoryBot for mock test data and offers experienced advice on how to avoid creating tests that fail randomly.
What You Will Learn
- Build a blog application from start to finish using test driven development
- Install and explore popular tools used in professional Ruby software engineering
- Evaluate the benefits of effective testing in RSpec
- Explore Capistrano for advanced user interface testing
Who Is This Book For
Beginner to intermediate Ruby software engineers who are interested in learning to use TDD with RSpec to test and build web applications using Ruby on Rails. Readers should have some basic experience with Ruby and Ruby on Rails and have read the "Getting Started with Rails" guide, or something similar.
商品描述(中文翻譯)
學習如何正確測試 Ruby 和 Ruby on Rails 應用程式,首先撰寫會失敗的測試,然後再實作應用程式碼以通過這些測試。本書將教導您如何在建立部落格的過程中使用 RSpec 進行測試驅動開發(TDD)。在本書結束時,您將能夠使用最新版本的 Ruby 3 和 Ruby on Rails 7,將完全測試過的部落格部署到自己的生產網頁伺服器上。
學習和熟悉測試驅動開發的最大挑戰是,軟體工程師通常無法想像在實踐中撰寫失敗的測試是什麼樣子。他們首先撰寫實作程式碼,然後才考慮在實作程式碼周圍撰寫測試。這導致測試通過是偶然的,或者根本沒有真正測試任何內容。本書將讓您有信心在 RSpec 領域特定語言中撰寫測試。在撰寫任何實作程式碼之前,您將看到測試如何「正確」地失敗,然後再繼續撰寫實作程式碼以通過這些測試。
本書介紹了撰寫 RSpec 測試的最新技巧,包括「系統」測試和常被忽視的「視圖」測試,以及如何將 RSpec 與其他工具(如 Capybara、無頭 Chrome 和新的網頁驅動程式 gem)整合。它還介紹了用於模擬測試數據的 FactoryBot,並提供了有關如何避免隨機失敗測試的經驗建議。
您將學到什麼
- 使用測試驅動開發從頭到尾建立部落格應用程式
- 安裝和探索專業 Ruby 軟體工程中常用的工具
- 評估在 RSpec 中進行有效測試的好處
- 探索 Capistrano 進行高級使用者介面測試
本書適合對象
對使用 TDD 和 RSpec 進行測試和建立 Ruby on Rails 網頁應用程式感興趣的初級至中級 Ruby 軟體工程師。讀者應該具備一些基本的 Ruby 和 Ruby on Rails 經驗,並閱讀過「Rails 入門指南」或類似的內容。
作者簡介
Greg Donald has been a professional software engineer since 1996 and has worked with Ruby on Rails since 2006. Prior to that, he worked on many Perl and PHP projects, often finding the lack of tests made them hard to maintain and extend. After having seen the results of software written using different testing methods, he became a test driven development enthusiast and practitioner, determining no other method would ever be more successful in producing quality software than TDD. He decided to write this book to promote TDD and share his positive experiences using it.
作者簡介(中文翻譯)
Greg Donald自1996年以來一直是一名專業的軟體工程師,並且自2006年開始使用Ruby on Rails。在此之前,他曾參與許多Perl和PHP項目的開發,常常發現缺乏測試使得這些項目難以維護和擴展。在看到使用不同測試方法編寫的軟體的結果後,他成為了測試驅動開發的狂熱支持者和實踐者,認定沒有其他方法能比TDD更成功地產生高品質的軟體。他決定撰寫這本書來推廣TDD並分享他使用TDD的正面經驗。