- Amazon Student members save an additional 10% on Textbooks with promo code TEXTBOOK10. Enter code TEXTBOOK10 at checkout. Here's how (restrictions apply)
Rails Test Prescriptions Paperback – Mar 10 2011
There is a newer edition of this item:
Special Offers and Product Promotions
Customers Who Bought This Item Also Bought
No Kindle device required. Download one of the Free Kindle apps to start reading Kindle books on your smartphone, tablet, and computer.
To get the free app, enter your e-mail address or mobile phone number.
About the Author
Noel Rappin is a Senior Consultant at Obtiva. A Rails developer for five years, Noel has spoken at RailsConf and Windy City Rails, and is the author of Professional Ruby on Rails from Wrox Press. A blog relating to this book can be found at http://www.railsrx.com.
Most Helpful Customer Reviews on Amazon.com (beta)
First off -- the book does do a creditable job of covering many options, and does a good job of delineating the differences between unit, functional, integration and acceptance testing - although it seems to go out of its way to blur the line between the latter two. Rails' own built-in Test::Unit is given a good introduction, as is what the author calls Controller testing. This is a reasonable name, but not necessarily the one you will encounter among the Rails community, and here is where one of the problems with this book arises.
Mr Rappin is not a gifted writer, and one problem is that his style lurches from conversational, "I remember trying this out" passages, to opaque, technical paragraphs that you may need some time to parse, or simply give up trying. The habit of drawing attention to his preferred naming conventions for things is part of the conversational part of the book that makes it read like course notes for a community college intro course.
And, Mr Rappin has not, it would seem, been granted the help of a top-notch editor. The book is replete with small typos, but more glaringly, with an at times bizarre approach to structure. Topics are frequently introduced without either foregrounding what they are for, or with references to other more advanced topics that are not explained. A good editor would have spotted these problems. The advanced topics of RSpec an Cucumber come up frequently in the context of their alternates, but withot any attempt to put them in perspective.
Examples are spread throughout the book, but the notation of the file they come from or should be inserted into are inconsistent, and sometimes entirely absent. This can be very confusing, especially if you're trying to read the book for an overview, before jumping in to try out the code provided. A good deal of the book is focused on using testing in various ways while developing a hypothetical group collaboration app called "Huddle". But this app is notional only, and a coherent listing that allows you to mark the progress of the development of the app, and see how testing fits in is absent. Even the idea of what Huddle does seems vague and undefined, which is ironic, since Rappin is trying to convince us that testing is an excellent way of defining an application or a feature, allowing us to see clearly what we are trying to achieve before we begin. On reflection, his book ends up being at times a pretty compelling argument against testing - perhaps some irony to be found there.
An example of the this is Rappin's introduction to acceptance testing. Acceptance testing is a powerful technique to clarify for a client what an app is meant to do, and, as Rappin insists at many points, is actually a design method, that precedes the actual writing of code. Rappin does a good job of drumming in the point that the word "test" implies a post-factum process, when in fact the best use of testing is to establish tests that fail, and then write code to satisfy them. But he introduces Cucumber, a testing approach that more than most really needs to precede code, at the end of the book, and in the context of the substantially complete Huddle app. Very strange.
The sections on RSpec are the best, and the overall impression of the book is that RSpec is the most flexible and detailed way to approach Rails app testing, without eliminating the need for things like Model testing. The weakest section is probably that on interface testing, admittedly a difficult subject, because of the underdevelopment of tools, and the ongoing reality that browser compatibility can't be done through testing.
Testing is something of a religious issue in the Rails community. Those who are not among the faithful are often skeptical that testing can really affect bottom-line productivity and accuracy. Rappin makes an anemic case for testing at the opening of the book, with a highly contrived an unconvincing example of how testing may cost you more time at the outset, or on simple projects (a common criticism), but that it "really" saves you tons of time overall. What Rappin, as the testing community in general fails to do, is to provide a convincing metric. Testing is about verifiability, and it seems little to ask that they support their belief with evidence. But again, it is a religious issue, and the demand for proof simply marks you as an apostate, so don't look for that kind of substantial support for testing in this book.
Testing is a rapidly changing field, and writing a book about it is fraught with the problem of obsolescence. Rappin has done a creditable job in this regard, and the book right now is not old enough to have too many glaring differences with reality and current practice. But it will have to be edited and parts rewritten as the field changes, and I hope that then the Pragmatic Programmers series will see fit to edit this book correctly, improve the structure and annotations, and generally bring what is currently a complete but confused mess up to the standard of a very good, clear one. In the mean time, there do not seem to be many published options, so despite its flaws, this may be the book to buy for those interested in incorporating Rails testing.
(A) the various tools that can be used to test all the various parts of a Rails app
(B) how and when to use those tools.
I've found it to be a good tutorial, and a pretty good reference ("How do I set up an RSpec controller test again?"). Highly recommended.
Update: I finished the book, and my impressions did not change. Great reference manual, poor 'how to' manual.
As a final bonus, tech books are notorious sleep-inducers, but Noel has an excellent dry sense of humour that serves to turn this book into a smile-inducer instead.
We are finally realizing how important testing is, which makes this book a must-have for your coding toolbox (and career).
It covers all the basics of unit testing, mocking, controllers, views, and gives nice gentle introductions to really helpful gems like webrat and others.
Whether you are a grizzled old testing vet, or you are just getting started with rails, Rails Test Prescriptions is bound to show you something you didn't know you could do before.
Look for similar items by category
- Books > Computers & Technology > Programming > Languages & Tools
- Books > Computers & Technology > Programming > Software Design, Testing & Engineering > Quality Control
- Books > Computers & Technology > Programming > Software Design, Testing & Engineering > Software Development
- Books > Computers & Technology > Programming > Software Design, Testing & Engineering > Testing
- Books > Computers & Technology > Web Development > Programming
- Books > Textbooks > Computer Science & Information Systems > Programming Languages