This post originated from an RSS feed registered with Ruby Buzz
by Jeremy Voorhis.
Original Post: Testing Roundup
Feed Title: JVoorhis
Feed URL: http://feeds.feedburner.com/jvoorhis
Feed Description: JVoorhis is a Rubyist in northeast Ohio. He rambles about Ruby on Rails, development practices, other frameworks such as Django, and on other days he is just full of snark.
This is just a brain dump with some of my recent thoughts about testing Rails applications.
Zed Shaw was recently interviewed on O’Reilly Net about his recent work with Mongrel. If you haven’t yet read that article, go ahead and read it now.
Zed talks about how he tests Mongrel’s performance, as well as fuzzing Mongrel. Later yesterday, Jason Watkins and I were discussing the feasibility of fuzzing a web application. Web applications have a huge parameter space, and though it may not be valuable to test every possible combination of input characters, it may be practical to test each input with data of varying size, ranging from zero to one and then increasing exponentially to a certain point.
It is also good to find boundary conditions for your server-side data as well. In a recent post, Obie Fernandez talks about the power of Ruby for generating data. It would be even more straightforward to generate a test data set between a couple of extreme boundaries to find out how your application fails with zero input, too many characters, junk characters, different encodings, etc.
Finally, I will leave you with an example of the format I have been using lately for functional tests. This code tests that the results are right for the wheel building resource of a very fictional, very high-tech bicycle factory. Similar tests which force errors and test boundary conditions would follow. The comments were added for clarity, but the whitespace would still be there.