Vous voulez voir cette page en français ? Cliquez ici.


or
Sign in to turn on 1-Click ordering.
or
Amazon Prime Free Trial required. Sign up when you check out. Learn More
More Buying Choices
Have one to sell? Sell yours here
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Rails Test Prescriptions [Paperback]

Noel Rappin

List Price: CDN$ 43.95
Price: CDN$ 27.69 & FREE Shipping. Details
You Save: CDN$ 16.26 (37%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Only 1 left in stock (more on the way).
Ships from and sold by Amazon.ca. Gift-wrap available.
Want it delivered Wednesday, September 3? Choose One-Day Shipping at checkout.
Save Up to 90% on Textbooks
Hit the books in Amazon.ca's Textbook Store and save up to 90% on used textbooks and 35% on new textbooks. Learn more.
Join Amazon Student in Canada


Book Description

March 10 2011 1934356646 978-1934356647 1

Rails Test Prescriptions is a comprehensive guide to testing Rails applications, covering Test-Driven Development from both a theoretical perspective (why to test) and from a practical perspective (how to test effectively). It covers the core Rails testing tools and procedures for Rails 2 and Rails 3, and introduces popular add-ons, including Cucumber, Shoulda, Machinist, Mocha, and Rcov.

Your Ruby on Rails application is sick. It's got bugs. Nobody remembers what that tricky piece of code was supposed to do, and nobody can tell what it actually does. Deadlines are looming, but every time you make the slightest change to the code, something else breaks.

You need Test-Driven Development (TDD), a proven process for improving the design, maintainability, and long-term viability of software. In TDD, the tests come first, and then code is written to match the expectation of the test. Using TDD means writing better code faster.

Ruby on Rails has unparalleled support for TDD. In addition to the tools that Rails has built-in, a large and thriving testing community adds new tools at an accelerating rate. Rails Test Prescriptions is your guide to the entire Rails testing ecosystem.

Containing both practical code examples and discussion of why testing works, this book starts with the most basic features delivered as part of core Ruby on Rails. Once you've integrated those features into your coding practice, you'll want to use popular third-party testing tools such as RSpec, Shoulda, Cucumber, Factory Girl, and Rcov. Rails Test Prescriptions will show you how to use these tools and when they are appropriate. Rails Test Prescriptions will cover both the current Rails 2.3.x version as well as the initial 3.0 release.

If you are a Rails programmer who tests code, this book is an invaluable guide to the latest in available testing tools. If you are a Rails programmer who doesn't test code, then start testing immediately: this book can help.


Customers Who Bought This Item Also Bought


Product Details

  • Paperback: 350 pages
  • Publisher: Pragmatic Bookshelf; 1 edition (March 10 2011)
  • Language: English
  • ISBN-10: 1934356646
  • ISBN-13: 978-1934356647
  • Product Dimensions: 1.8 x 18.8 x 22.4 cm
  • Shipping Weight: 522 g
  • Amazon Bestsellers Rank: #563,567 in Books (See Top 100 in Books)

Product Description

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.


Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

Customer Reviews

There are no customer reviews yet on Amazon.ca
5 star
4 star
3 star
2 star
1 star
Most Helpful Customer Reviews on Amazon.com (beta)
Amazon.com: 4.0 out of 5 stars  5 reviews
16 of 20 people found the following review helpful
2.0 out of 5 stars Confused, but possibly the best option June 8 2011
By D. Donaldson - Published on Amazon.com
Format:Paperback
Testing has been a gap in my Rails practice, and I got this book as part of a concerted effort to close that gap. I had some knowledge of the general options and types of testing that are available to Rails programmers, but like many who had come from other languages and frameworks, I didn't see the immediate necessity to incorporate testing into my work. But the reality is that testing is an important skill in the job market for Rails work, and I decided that I would take it seriously.

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.
6 of 7 people found the following review helpful
5.0 out of 5 stars Excellent resource Feb. 26 2011
By Pennomme - Published on Amazon.com
Format:Paperback
This is a great book if you're looking to understand:

(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.

This is a good overview of the "State of the Art", as of publication date, of the various testing technologies for Rails apps. It has good sections on the basic tools that come with Rails (the standard unit testing package and fixtures) including the often overlooked integration tests. Then it's on to the tools which don't come standard; Shoulda, RSpec, and Cucumber. The book does a good job of showing how to use these tools, and gives a thumbnail sketch of their philosophies, so you understand why they were built. The sections on the javascript and view testing tools Jasmine, WebRat and Capybara ("the rodents") are useful pointers towards what can be done with these tools, but it doesn't cover them in the same depth as some of the other 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.
1 of 1 people found the following review helpful
3.0 out of 5 stars Not the best book for a total testing noob... Jan. 20 2012
By John Mark Locklear - Published on Amazon.com
Format:Paperback
I have been doing Rails programming for about a year and needed to add testing to my repertoire. I am about half way through the book and am disappointed with the number of examples that are not *in context* of an application. At the beginning of the book there were a handful of examples for a fictitious 'huddle' application. These examples where very helpful. However, the last few chapters (chapters 6,7,8,10) have had plenty of code samples, but these samples are outside the context of a real application, so they are not very helpful to the uninitiated. I am just getting to the section on RSpec, and there is code for a rspec version of huddle, so I am hopeful. What I am finding is that a majority of the book is more of reference manual, rather than a 'how do I use this in a real application'. Head First for Rails Testing anyone? If my impressions change any by the time I reach the end of he book (if I can make it) I will update this review.

Update: I finished the book, and my impressions did not change. Great reference manual, poor 'how to' manual.
2 of 3 people found the following review helpful
5.0 out of 5 stars Good Solid Overview March 16 2011
By Larry - Published on Amazon.com
Format:Paperback
The Rails testing landscape has blossomed far beyond Test Unit, and this book does a good job of describing the current alternatives, giving some background, pros, cons, and how to set up and use each one. Given the frequency with which many developers hop around, this book will prove invaluable in getting you up to speed quickly on whatever tools are being used in your new environment. It will also enable you to make informed decisions to use (or not use) something if you are starting from scratch.

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).
1 of 4 people found the following review helpful
5.0 out of 5 stars Everything you need for getting started March 29 2011
By J. Rasmusson - Published on Amazon.com
Format:Paperback
Noel has done a wonderful job aggregating, and curating the best rails practices and tools into one solid book.

It covers all the basics of unit testing, mocking, controllers, views, and gives nice gentle introductions to really helpful gems like webrat and others.

I also like how the book was broken up with sections dedicated to testing JavaScript and AJAX, along with a good intro to RSpec and behavior driven testing with Cucumber.

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


Feedback