- 本カテゴリの商品を2500円以上購入で買取金額500円UPキャンペーン対象商品です。商品出荷時に買取サービスでご利用いただけるクーポンをメールにてご案内させていただきます。 詳細はこちら (細則もこちらからご覧いただけます)
The RSpec Book: Behaviour Driven Development With RSpec, Cucumber, and Friends (The Facets of Ruby Series) (英語) ペーパーバック – 2010/12/15
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
Behaviour-Driven Development (BDD) gives you the best of Test Driven Development, Domain Driven Design, and Acceptance Test Driven Planning techniques, so you can create better software with self-documenting, executable tests that bring users and developers together with a common language.
Get the most out of BDD in Ruby with The RSpec Book, written by the lead developer of RSpec, David Chelimsky.
You'll get started right away with RSpec 2 and Cucumber by developing a simple game, using Cucumber to express high-level requirements in language your customer understands, and RSpec to express more granular requirements that focus on the behavior of individual objects in the system. You'll learn how to use test doubles (mocks and stubs) to control the environment and focus the RSpec examples on one object at a time, and how to customize RSpec to "speak" in the language of your domain.
You'll develop Rails 3 applications and use companion tools such as Webrat and Selenium to express requirements for web applications both in memory and in the browser. And you'll learn to specify Rails views, controllers, and models, each in complete isolation from the other.
Whether you're developing applications, frameworks, or the libraries that power them, The RSpec Book will help you write better code, better tests, and deliver better software to happier users.
""Some authors would be satisfied with just writing the definitive guide for a technology. These folks go a step further, and show you insider tips that will keep your tests clean and maintainable.""--Ian Dees, Software Engineer
""The second generation of tools for the XP generation explained by their creators and maintainers. Awesome, a must read.""--Marcus Ahvne, software developer, Valtech
""The RSpec Book teaches you much more than how to use RSpec's features; it teaches you how to write code the way the RSpec team does: patiently, and with great precision and clarity. There is something here for everyone: beginners are given plenty of gentle attention but there is some real meat for the more experienced reader to chew on, too.""--Matt Wynn, independent programmer and coach商品の説明をすべて表示する
The book is divided in five parts. It feels a bit like the parts are written by different authors independently, which isn't unlikely considering the amount of authors. That's too bad as some cross-referring would have made the book better.
The first part is tutorial style where it simulates implementing a project Behavior-Driven-Development-style (BDD). The project is the traditional problem of code-breaker where you need to guess a code and get some hints on how well you did. It drives the project by first writing cucumber specs, then test-driving the implementation using RSpec. The tutorial is simple (perhaps even simplistic) and goes on for about 100 pages.
The second part of the book is the philosophy behind BDD. It is short, consisting of only 2 chapters. The first describes how traditional projects work... or actually how they do not work. Then it quickly runs over some ideas behind agile development and how that is different. The next chapter makes a case for by showing how BDD actually focuses on the communication between developers and customers.
The third part is the RSpec part of the book (where it got its name :P). It's about a 100 pages and does a pretty good job in describing RSpec. The only thing that I was missing was that it could explain a bit more about the RSpec internals... at least I would have found that interesting.
The fourth chapter is the "and more!" part of the book where is introduces cucumber (in the RSpec book :P). The Cucumber introduction isn't fantastic and is pretty short (and has quite some overlap with the tutorial). I wouldn't recommend this book for the cucumber introduction anyways but instead it would probably be better to read... the cucumber book (published about 2 years later).
The last chapter is the rails chapter where it takes rspec and cucumber and explain how to use the extensions for writing features and specs for rails apps. Here, some of the text is already a bit obsolete as the technology moves fast. Still, the concepts are about the same. It contains 3 chapters on cucumber and 3 on rspec.
All in all, I found it a pretty good read and enjoyed most of it. It could be a bit thinner and faster for me as it felt a bit repetitive at times. Partly this was because because some chapters could be integrated better together. For the RSpec part, I'd rate the book 3 stars as it does a good job in describing rspec. But the book is much more than The RSpec Book... therefore I'll give it 4 stars (yet, for Cucumber, it is better to pick up the Cucumber book)
As I read and tried many of the little tiny examples in the book, and eventually decided that I do not want to do Cucumber (I do not need to spend the extra time to generate code to translate requirements from English, RSpec is clear enough for me). Unfortunately (from my perspective), much of the book rambles on about Cucumber and integrating it with RSpec.
As I went through the book and I found a section of code that interested me, it too frequently told me that I would hear more details later on, which I found quite frustrating. I was ready for the down-low, and never seemed to find it, until I eventually jumped to Chapters 23, 24 and 25. Chapters 23, 24 and 25 are the chapters that walk you through the process of developing Test/Behavior driven View, Controllers and Models. This is what I needed to get my project going.
This book is worth it, even if you only look at the RSpec chapters.
Oh, by the way, when you are looking into the tools you want to use for integration testing, I recommend looking into Capybara, which is not talked about in the book.
I hope this helps.
Dave Taylor (tayloredwebsites.com)