[rspec-users] Spec'ing via features
apremdas at gmail.com
Mon Nov 24 11:30:45 EST 2008
Its tempting to see features as a kind of extended test tool, I
certainly looked at them in that way initially. However I think this
isn't really the most profitable way to look at them, nor how they
were designed. It would probably be worthwhile if you looked up some
articles on BDD, and perhaps pondered a little further on the ideas of
customer developer communication, and of features driving development.
Also have a look at the declarative vs imperative feature stuff that
has appreared in this list and in Ben Mabey's articles.
Once you do this you might agree that features are not an appropriate
tool for doing low-level testing, like testing individual models and
controllers. They certainly can reduce the need to do some tests in
the normal rails/rspec testing stack e.g. view testing but there much
more a design/communication tool than a testing tool
In particular I don't see that driving unit tests with features as
being particularly productive because
1) Customers don't need to know the details of unit tests (they're is
to much detail for them to comprehend). In fact writing unit tests as
features actually pollutes the feature space meaning that you end up
having to try and seperate one kind of feature from another
2) Programmers should be able to understand unit tests (they don't
need the story format)
3) Unit tests are by nature very detailed and the step matching step
writing mechanism is pretty inefficient at expressing this, even with
4) Features run slowly in comparison to well written test suites, so
running autospec with them gets unproductive fairly quickly. This will
be made worse if you create lots of extra features.
To summarize see features as things that drive development and bridge
the customer developer divide, then once you start developing
something use unit tests to ensure the intimate details of your models
and to help with regression etc.. Then have a ponder about what you
need in the controller, view testing area. This should work fairly
well in Rails if you use 'fat model skinny controller'.
There's definitely the need for a really insightful blog article(s)
into the detail of moving through this process of feature to
implementation via unit test etc.. I get the feeling there's quite
alot of personal style involved and certainly haven't worked out how
to do it myself yet
2008/11/21 James Byrne <lists at ruby-forum.com>:
> James Byrne wrote:
>> into this. Now, so far I have considered three possibilities:
> Ok, five...
> Posted via http://www.ruby-forum.com/.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users