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,080
  • 貴賓價: 9.5$1,976
  • 語言: 英文
  • 頁數: 232
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1484297474
  • ISBN-13: 9781484297476
  • 相關分類: RubyTDD 測試導向開發
  • 立即出貨 (庫存 < 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 以進行高級用戶介面測試

**本書適合誰**

適合初學者到中級的 Ruby 軟體工程師,對學習使用 TDD 與 RSpec 測試和構建使用 Ruby on Rails 的網頁應用程式感興趣。讀者應該對 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,並分享他使用 TDD 的正面經驗。