Andrew,
For scenario names, I prefer to think of the feature files in terms of
documentation rather than tests. A few years from now, when you or
someone else is looking to understand the current system, what will you
(or they) be looking for.
When I look at it this way, Matt's advice is a good starting point.
For example, I would be unlikely to be searching for "successful
payment" and "failed payment." In fact, there are likely to be multiple
reasons for "failed payment."
I'm far more likely to look for descriptions of the different
significant conditions, to see how each is handled.
Scenario: valid payment details
Scenario: invalid card number
Scenario: missing CVV number
Scenario: mismatch between name and card
Scenario: payment processor declines
Scenario: payment processor fails to reply
Scenario: payment processor technical error
The name of the scenario is sufficient to know that the situation has
been considered. It's better to read the scenario to know the outcome
that is expected. Putting the outcome in the title leads to unwarranted
assumptions and, over time, obsolete statements.
- George
On 11/16/16 8:40 PM, QA Collective wrote:
> Hello all,
>
> As this is my first post to this forum, G'day from Australia - my name
> is Andrew.
>
> I'm currently QA manager of a small team in an agile project that is
> standing up a completely new solution and to build it, a completely new
> tool set.
>
> As a project that will have far-reaching impact across an entire
> government (wide & diverse business audience), I have decided that
> Cucumber is the best choice when it comes to building a common language
> to talk about how our solution should behave in fulfilling requirements,
> and simultaneously automating to reap the full benefits of BDD and
> eventually, CI.
>
> We are currently in the process of writing up many scenarios from some
> pre-existing waterfall style Requirements Specifications documents. I
> see it as good practice before we have to do this in concert with
> business people. Each of my team have read the Cucumber book and we are
> all aspiring to best practice in the way we write them (concise,
> incremental, declarative, layered abstraction).
>
> We have a question about best practice in naming scenarios and have
> turned to guidance in The Cucumber Book, but have interpreted a key
> sentence differently.
>
> On pp 34, in a 'Matt says' caption, the final paragraph states:
> /
> /
> /"A good tip is to avoid putting anything about the outcome (the Then
> part) of the scenario/
> /into the name and concentrate on summarizing the context and event
> (Given and When)/
> /of the scenario."/
> /
> /
> I have interpreted this to mean that the scenario name can include a
> summary of intended outcome ("Successful payment"=GOOD) but not the
> details of that outcome ("Payment success message and confirmation
> email"=BAD).
> My colleague has interpreted this to mean that the scenario name should
> not include *any* intended outcome ("Successful payment"=BAD) and *only*
> include context ("Submit valid payment details"=GOOD).
>
> My argument is that expressing intended outcome is concise,
> understandable by business and helps 'roll-up' (i.e. can read scenario
> names without having to read steps). Perhaps it is not very 'future
> proof' when things get more complex?
>
> My colleagues argument is that he accepts Matt's advice verbatim and
> that from reading the scenario, one can /assume/ that "Submit valid
> payment details" will result in a successful payment.
>
> Which title would people here say is 'best practice', or are we
> splitting hairs?
>
> Full example (steps are identical):
>
> *Scenario: Successful payment*
>
> /Given I have progressed to payment/
> /And I have entered valid payment details/
> /When I submit payment/
> /Then I see a success message/
> /And I see a new message in my mailbox/
> *
> *
> *Scenario: Submit valid payment details*
>
> /Given I have progressed to payment/
> /And I have entered valid payment details/
> /When I submit payment/
> /Then I see a success message/
> /And I see a new message in my mailbox/
>
> Thanks in advance for all your advice!
>
> Andrew
>
> --
> Posting rules:
http://cukes.info/posting-rules.html
> ---
> You received this message because you are subscribed to the Google
> Groups "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
cukes+un...@googlegroups.com
> <mailto:
cukes+un...@googlegroups.com>.
----------------------------------------------------------------------
* George Dinwiddie *
http://blog.gdinwiddie.com
Software Development
http://www.idiacomputing.com
Consultant and Coach
http://www.agilemaryland.org
----------------------------------------------------------------------