Working Effectively with Unit Tests

Jay Fields

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

相關主題

商品描述

This book details Jay Fields' strong opinions on the best way to test, while acknowledging alternative styles and various contexts in which tests are written. Whether you prefer Jay Fields' style or not, this book will help you write better Unit Tests.

From the Preface:

Over a dozen years ago I read Refactoring for the first time; it immediately became my bible. While Refactoring isn’t about testing, it explicitly states: If you want to refactor, the essential precondition is having solid tests. At that time, if Refactoring deemed it necessary, I unquestionably complied. That was the beginning of my quest to create productive unit tests.

Throughout the 12+ years that followed reading Refactoring I made many mistakes, learned countless lessons, and developed a set of guidelines that I believe make unit testing a productive use of programmer time. This book provides a single place to examine those mistakes, pass on the lessons learned, and provide direction for those that want to test in a way that I’ve found to be the most productive.

The book does touch on some theory and definition, but the main purpose is to show you how to take tests that are causing you pain and turn them into tests that you're happy to work with.

商品描述(中文翻譯)

這本書詳細介紹了Jay Fields對於最佳測試方式的堅定觀點,同時也承認了其他風格和不同測試撰寫情境的存在。無論你是否喜歡Jay Fields的風格,這本書都能幫助你撰寫更好的單元測試。

在前言中提到:十多年前,我第一次閱讀了《重構》這本書,它立即成為我的聖經。雖然《重構》並不是關於測試的,但它明確指出:如果你想進行重構,必須先擁有堅實的測試。當時,如果《重構》認為有必要,我毫不猶豫地遵從。那是我開始追求創建有效單元測試的開始。

在閱讀《重構》之後的12多年裡,我犯了許多錯誤,學到了無數的教訓,並制定了一套指南,我相信這些指南能使單元測試成為程序員時間的有效利用。這本書提供了一個地方來檢視這些錯誤,傳遞所學到的教訓,並為那些希望以我認為最有效的方式進行測試的人提供指引。

這本書確實涉及一些理論和定義,但主要目的是向你展示如何將讓你痛苦的測試轉變為你樂於使用的測試。