[rspec-users] [BDD] View specs and cucumber -- duplication of effort?

Chuck van der Linden sqapro at gmail.com
Thu Nov 5 17:55:54 EST 2009

On Nov 4, 5:30 pm, David Chelimsky <dchelim... at gmail.com> wrote:
> On Wed, Nov 4, 2009 at 3:36 PM, Stephen Eley <sfe... at gmail.com> wrote:
> > On Wed, Nov 4, 2009 at 3:24 PM, Andrew Premdas <aprem... at gmail.com> wrote:
> > > Personally I now think nested steps are evil - but thats another story :)
> > It sounds like an entertaining one.  I'd love to hear why sometime.
> > (Though whether the right place for it would be here or the Cucumber
> > list, I couldn't say.)
> I'll pipe in since it's here on this list at the moment:
> I won't go as far as to say that nested steps are evil, but I don't really
> like to use them myself because they do conflate two levels of abstraction.
> I'd sooner have two steps delegate to a helper than one step delegate to
> another.
> David

I'll chime in also as to why I really dislike burying details like
that in the steps file.  Nobody but dev plays around with the lower
layers and the step files in particular.  Potentially everyone in the
business may have a hand in the 'feature' definition, or maybe need to
see or modify it at a later time.  Also a Dev or tester reviewing
things to see 'how should it work' gets everything high level in one
place (the feature file) instead of having to chase down into multple
levels of step files ( an exercise reminding one of why we hate
spaghetti code) to find the details that matter up at the UI or
potentially integration test level.

Remember Rspec/Cucumber are all about implementing BDD..  Part of BDD
is that more than just the folks in Dev will be looking at what's done
at the 'feature' level.   If you bury the details of something inside
the step file, then nobody outside of dev can play along, and that
defeats a large part of the purpose of BDD.

If it is important to the business that a particular field be on that
page, then you ought to have it expressed in the feature and not
buried in the steps.   Consider something like

'Scenario: User reviews their profile details'
Given I am logged in as: <user>
When I click the link: view profile
Then I should see my profile details.

How much more value to the business (and clarity to those implementing
the feature) is created if we were to instead have something more

Then I will be on the page: User Profile
and I will see <field1> identified as <field1label> containing
and I will see <field2> identified as <field2label> containing

The <> items could either of course be spelled out, or they could be
parameters in a scenario outline's examples section.


More information about the rspec-users mailing list