30 of 31 people found the following review helpful
on February 19, 2011
Behavior Driven Development is an important new methodology, and the authors of The RSpec Book provide a solid introduction to the theory and practice of BDD. However, I feel this book would have been just as good as a series of blog posts. This is not meant to denigrate the book, into which I know much effort was invested. However, the examples in the book fail to tackle the real-world challenges that you will face when implementing BDD.
Einstein said "Everything should be kept as simple as possible, but not simpler." A common fault of software courses and books is an avoidance of real-world complexity. For example, in The RSpec Book, the last 3 or 4 chapters are on BDD with Ruby on Rails. The sample application that is developed is ridiculously simple. Also, no cucumber specs are developed for it, so we are basically writing code for its own sake, rather than executing on the BDD mantra of "writing software that matters."
Both BDD and Ruby on Rails are meant to offer solutions for large, complex software projects and the ins and outs of their proper usage can only be learned by application to software that goes well beyond toy functionality. In a large Rails projects, with dozens of models with complex associations interacting with multiple gems, managing RSpec examples and Cucumber scenarios is a project in and of itself. The introductory example application "CodeBreaker" is better because it shows the full BDD development cycle with both cucumber and RSPec. Perhaps the authors should have built on that same example in the Ruby on Rails chapters.
In the end, if you want to learn BDD, you definitely should buy this book. The authors would do well, however, to bring in more of their real world experience in future editions.
One final note for those interested in advice on real-word BDD best practices, google "You're cuking it wrong" by Jonas Nicklas.
27 of 29 people found the following review helpful
on February 2, 2011
I hate to be the first one to give a less than great review of this book, especially since several of the authors are chiefly responsible for these great testing tools to be in existence. But I'd probably be even harder on the book than I am if I knew of a good alternative, which I don't. So best I can tell, this is still the best book to learn BDD using RSpec and Cucumber.
There seems to be a fair amount of errata that didn't get fixed prior to going to print. In fact, the book on whole seems like it could have used more in the editing process. I question the organization of the book; however I do get a sense of what the authors were trying to accomplish.
I am sympathetic to the challenges of writing a book for technologies that are very rapidly changing; that said, at a conference in June 2010, the author had already switched to using Capybara instead of Webrat, so I was shocked that the book went to print in December 2010 without mention of Capybara, which from what I can tell, seems to be the new de facto standard for browser simulation.
No doubt BDD while easy to understand at an abstract level, seems to be an art hard to explain concretely. Surely examples are the best way to learn, and fortunately this book does use plenty of examples. I love that they devote 100 pages specifically to BDD in Rails (although I'm sure developers using other languages and frameworks don't). I'd say this edition of the book is a good 0.8 release, and I look to the inevitable 1.0 (aka 2nd Edition).
14 of 15 people found the following review helpful
on April 28, 2011
I am a long time Web Developer, ramping back up on RoR. I was looking for a book that would help me develop a good solid testing environment on this new Rails 3 project that I am creating.
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)
7 of 7 people found the following review helpful
on January 29, 2011
I found the organization of the book to be a little disorienting: right off the bat we jump into a BDD workflow, and only later in the book do we get introduced to the actual frameworks. As someone who has already spent enough time with the tools prior to picking up this book, I was able to follow along, but I wonder if someone less familiar would not find this organization confusing. In reality, I think this book is a reflection of the very learning process that the authors have gone through themselves while writing the frameworks and the book itself. It feels like this book is really a two in one: philosophy of and for BDD, and a manual for existing tools - and hence the confusing organization.
Having said all that, if you are interested in learning about BDD, or improving your existing BDD workflow, then this is definitely the book you are looking for. Along the way you'll also learn about the internals of RSpec, Cucumber, Rails + BDD, and a variety of other tools.
8 of 9 people found the following review helpful
on March 15, 2011
The RSpec Book is a 400 page book by David Chelimsky and a cadre of BDD (Behavior Driven Development) experts. Its aim is to teach you all about RSpec (RSpec 2.0 - specifically!) and BDD from the ground up and it promises to "help you write better code, write better tests, and delver better software to your users."
Robert C. Martin (a.k.a. Uncle Bob) kicks off the book with a foreword that warns us of what's to come. He says that the book is a trap and isn't really about RSpec. I won't spoil the whole surprise of his delivery but his general point is that the book is focused on teaching you software craftsmanship using BDD (and testing in general) as the framework for putting together well-crafted software. This point is significant because The RSpec Book focuses on the concepts of BDD just as much as it does on the technicalities of RSpec itself.
The book starts with an extensive Getting Started section headed by a quick chapter summarizing RSpec and Cucumber before moving on to a suite of walkthrough-style chapters dedicated to building a 'code breaker' game. Acceptance Test-Driven Planning is used which essentially means the acceptance tests are written first in the form of Cucumber features so for two chapters you don't get to see any RSpec at all. Once RSpec comes into the mix, though, things move quickly and mocks (doubles) and stubs are introduced quickly. The 'code breaker' game work then continues for a couple of chapters with a brief detour into refactoring.
The second section of the book - Behavior Driven Development - is made up of two code-free chapters that look at BDD from a higher level. A lot of this portion is quite opinionated but if you want to get an overall feel for the BDD process and how different concepts interlock with it, it's a great primer.
The third section of the book - RSpec - proved to be the real "meat" for me. There are several chapters digging solely into the ins and outs of RSpec 2.0 itself. You learn how to use RSpec from the basics up, working through matchers, best practices, mocks, macros, custom formatters, custom matchers, and how the RSpec toolkit can integrate with other tools (such as TextMate). You basically get a 102 page guide to RSpec 2.0 here and that might be worth the price of admission alone.
Sections dedicated to Cucumber and Rails follow on to close the book. I found the Rails section particularly useful having not previously gotten on to the RSpec 2 bandwagon with Rails 3. There are several chapters that each walk through a particular topic, like view specs, controller specs, and model specs. I didn't want to digest the entire set at once and the structure helped me just dig into the parts I was immediately interested in without following each chapter in order. The large number of short and sweet code examples also helps if you're just scanning through looking for some guidance.
In short, I recommend The RSpec Book. The other reviews here seem to be rather mixed so you might want to check them out to get the bigger picture, but I've found the book to be rather useful with its direct narrative style, logical structure, and vast number of short code examples from which to descry some handy techniques.
2 of 2 people found the following review helpful
on February 13, 2013
I find the RSpec book hard to review as on one hand, it's excellent, but on the other hand, I felt it could be still much better. Also, with the introduction of the more recent Cucumber book, makes it hard to appreciate the extra stuff in this book as it is quite a bit overlapping with that of the Cucumber book. I still enjoyed the book.
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)
2 of 2 people found the following review helpful
on May 15, 2013
Very good for beginners in BDD design but last printed on 2011 so a bit dated as the Ruby-verse moves quickly. Some features in current rspec (2.13.1) which is about 9 iterations ahead of the rspec discussed in the book. it would be nice to get an electronic supplement that is more up-to-date.
1 of 1 people found the following review helpful
on May 26, 2014
I bought this book to obtain a more in-depth treatment of rspec that some of the other books I have read didn't have. Rspec is the framework used for testing where I work and I needed to get up to speed on it. Part I of the book starts with an introduction of rspec and cucumber and then proceeds to illustrate BDD with these two tools for a simple game known as a code breaker. I thought this part presented very well. Real world applications tend to be much more complex than the simple one presented here, but hopefully the principles will apply (with some modifications as appropriate). Part 2 describes BDD in a little more detail while Part III and Part IV cover rspec and cucumber respectively. The part about Rspec is quite good - there is a fair amount of detail with ideas on when to use what along with examples. Part IV is also okay but it seemed to not have enough depth - this isn't necessarily an issue as there is another book on Cucumber I intend to read soon. Part 5 is about applying BDD to Rails. I usually test out the code samples in every book I buy by typing them out from the book and not downloading the source (unless absolutely required). Once concern I had when I purchased this book is that the versions of the gems used in the book are outdated and therefore the code may not work on newer version of gems. As a matter of fact, the book recommends using the versions of the gems that the original was source was tested with. I had instead used the latest version of all gems. In Parts I through IV, not many changes are required to get the source to work properly with the newer versions of the gems. Occasionally there may be warning (for instance, in Rspec, Stub is deprecated, use double instead) and this was easy to fix and once fixed, the warning went away. The only part that I didn't try the samples was Part V - BDD with Rails - the reason being the book uses Webrat but Capybara seems to be the popular choice now in the community. The book does cover Selenium and includes ideas for testing different components of Rails, so the ideas are usable, but the source code isn't out of the box. In other words, this section of the book is outdated. Not withstanding the caveats, this book is still worth a read.
on April 28, 2013
I purchased the Kindle edition and I am referring to book continually while I tackle a new project at work. I cannot express enough my appreciation for Dave and team walking me through a thorough TDD project from soup to nuts.
I'm probably the ideal audience for this work. I'm a sysadmin who's been informally hacking Ruby for a few years, but needed to bring more rigor to my work. I'd dinked around with RSpec before but hadn't committed myself to TDD. I decided to have this book and Eloquent Ruby at my side while I started a new project, and both have helped tremendously with code that is simply better in all respects.
The reviewers who fault the authors for not bringing in enough real-world experience have a point, but I think doing so would have made tougher going for those with less experience. I do hope the authors follow-up with another book with more tips from the trenches.
on January 8, 2015
When our team was asked to start to do automation testing with selenium and rspec, the developers were very worried about the learning curve involved. When we decided to get this book to give us an overview, it ended up being a solid book that went beyond an overview. The developers loved the simplicity of the reading and how immediately we could dive right into automation testing at a beginner level and use the book to lead us into higher levels of understanding. This book will do it for you if you are looking to get a beginner to advanced understanding for writing tests.