[rspec-users] Advice / Turning a Usecase into a Rspec Story / Granularity ofstories

joseph joe at eshopworks.co.uk
Thu Apr 3 05:15:04 EDT 2008


I'm having some trouble working out what the granularity of stories
should be.

I have a use-case 'manage page', for a blogging system (like wordpress)
I'm building.

The single use-case covers - add page,delete page,edit page,preview page

With the use-case we avoided getting too fine a level of granularity
(i.e. add page use-case, delete page use-case...), to keep the clients
and us sane.

I tried to maintain a convention of converting a use-case into a rspec
story. Mainly to make it easier for the client to engage in the

Example Story (High level):

Story: Web admin manages pages within the admin system
Scenario: Add page
Scenario: edit page.
Scenario: delete page.

I'm unsure if this granularity is productive for a rspec story. Whether
it will lead to a bloated story and if the scenarios become less
obviously link to the title/narrative. I have a nagging doubt that
perhaps it should be:

Example Story (Low level)

Story: Web admin adds a page
Scenario: without some special fields
Scenario: Setting publish dates

Have people experienced this issue before?
Does anyone have any comments or suggestions?

Joseph Wilk

On Mon, 2008-03-17 at 09:40 +0100, Bart Zonneveld wrote:
> No replies? That doesn't happen very often :).
> regards,
> bartz
> On 13-mrt-2008, at 14:13, Bart Zonneveld wrote:
> > Hey list,
> >
> > I'm refactoring some much-used functionality into a common_steps step
> > group. Methods like this are in there:
> >
> > steps_for :common do
> >    Given "a number of existing $types?" do |type|
> >      @initial_item_count = type.singularize.classify.constantize.count
> >    end
> >
> >    When "the user adds an invalid $type" do |type|
> >      post "/#{type.pluralize}/create", type.to_sym => {}
> >    end
> >
> >    When "the user adds a valid $type" do |type|
> >      post "/#{type.pluralize}/create", type.to_sym => valid_attributes
> >    end
> >
> >    Then "there should be $number more $type? in the system" do |
> > number, type|
> >      type.classify.constantize.count.should == (@initial_item_count +
> > number.to_i)
> >    end
> >
> >    Then "there should be an error message explaining what went  
> > wrong" do
> >      response.should have_tag('div#errorExplanation')
> >    end
> >
> >    Then "the user should see the form again" do
> >      response.should have_tag('form[method=post]')
> >    end
> > end
> >
> > This more or less works for me. However, I'm interested in two
> > things. First, is this good practice? It's DRY, but I'm coupling my
> > stories to these common steps in a way.. And second, is it possible
> > to define a method in my specific stepgroup, that can be called from
> > my common stepgroup?
> > For instance, in the "user adds a valid type" step, I call a
> > valid_attributes method. I'd like to define that on the specific
> > stepgroup, but so far I haven't been able to get it called...
> >
> > thanks!
> > bartz
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Latest News:-

* www.phaidon.com launch their new site on WORKSsitebuilder

*  www.pukkaherbs.com are experts in all things Ayurvedic. They have launched their new store on WORKSsitebuilder


This email was obviously intended for the people nnotremed in the message.  It may be confidential and/or legally privileged.  If you have received it by mistake, please take no action based on it, copy it, or show it to anyone - just delete it and let us know about the error. Also, we should point out that any opinions expressed are not necessarily those of eShopworks.

Unfortunately email cannot be guaranteed to be secure or error-free and thus this email should not be construed as a solicitation for, or offer of contract. If verification is required please ask us for a hard-copy.

And finally, while we've scanned this email on 3/4/2008 to make sure it is virus free to be on the safe side we recommend that you also scan it with your own antivirus software.  


More information about the rspec-users mailing list