On Apr 22, 2010, at 9:57 AM, Zach Moazeni wrote: > I'll jump in here as I was one of the guys who presented a shift in my > testing strategies at the Great Lakes Ruby Bash. > > To give some context, I've built projects that were very focused on isolation > tests that used Rspec and Mocks to assert behavior. I do think there is merit > in using BDD as a code-design tool, however I have also maintained large test > suites that had more historical context than regression value. I consider > this inside-out testing. Developing/Testing at the unit level and then > bubbling out to an Acceptance test. > > I've been subtly migrating to what I consider outside-in testing, starting > with Acceptance tests and then moving to a unit level if necessary. And as a > result I've felt much better about the codebases (including the tests). > Although I was getting a bit uneasy since I haven't heard of other developers > experiencing similar pain points. Talking with a few developers at the Great > Lakes Ruby Bash was really refreshing because not only did it sound like they > had similar pains, but they were going down the same path I was. > > I was one of the guys who did a lightning talk on a library I'm working on > (Harvested, a Ruby API wrapper for Harvest > http://github.com/zmoazeni/harvested). And I do have a 90/10 split in > Acceptance vs Unit with I'm cool with. I wasn't throwing out those numbers as > what you should shoot for, but just anecdotal experience. > > I recognize that I may be criticized for writing untested code or that I'm > disagreeing with BDD/TDD. I'm don't think I am. I feel I've gone way too far > on the side of testing, and after reflecting on my experiences with past > projects feeling the pendulum swinging back towards a healthy balance. > > Some specific opinions I have are: I don't test Controllers or Views or > Rails-DSL validations (e.g. validates_presence_of, validates_uniqueness_of). > I do test "interesting validations", and instead of testing "interesting > controller actions" I prefer to refactor that so the controller is very > minimalist. The same goes for views, I pull away anything that looks > "interesting" in a view. This is totally subjective, so I don't have a great > way to clarify what I mean by "interesting". > > I don't disagree with mocks, but I would rather have a "boxed functional > test" (sorry running out of language here) that test how multiple objects > behave together and use mocks/stubs to form the boundaries of the tests. > > Hopefully this doesn't come across as another post of "I don't see the point > of testing", or "Mocks are silly". Additionally, I'm a bit nervous posting > these thoughts to an audience that are most likely going to disagree with > this strategy. So I would welcome any support along with critiques on these > ideas.
I know several people who have reported success using a similar approach. Pat _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users