On Dec 30, 2009, at 3:52 pm, Francis Fish wrote:

> Given I am logged in as an admin user
> And I am in the blah area
> When I select edit blah
> Then I will see the edit blah screen
> 
> Then I want to be able to create some way of saying I can edit a field or 
> fields of a blah.
> 
> I've created something like this:
> 
> Scenario Outline: create blah details
>   Given I am logged in as a creator
>   And I am creating a blah
>   Then I can input the value of <field>
> 
> Scenarios: blah fields
> | field |
> | Name |
> | Description |
> 
> It just seems a little primitive and repetitive for something that's on 
> release 10 or so and the linking of named artefacts ever so slightly opaque 
> and magic spell. I want to put all of this in one description, basically all 
> the CRUD and index stuff without having to repeat myself over and over again.

Hi Francis

Well Andrew's nudged me into replying, and this is the stuff I allegedly do for 
a living after all :)

BTW, not watched that Cucumber video in case I duplicate stuff on it.

I have settled on a fairly standard template for CRUDL - that's CRUD + List.  
Used as a verb, eg the bizarrely sinister-sounding phrase from my most recent 
project - "let's crudl some children".  I've included a sanitised example below.

Doug's example is fine, in terms of getting multiple fields into one scenario 
run.  (Which avoids repeated background setup.)  But you can go a step further 
and put the data horizontally.  This lets you write steps to bulk-create data, 
eg:

  Given the following times table facts:
    | Multiplicand | Multiplier |
    | 5            | 2          |
    | 5            | 3          |
    | 5            | 4          |
    | 5            | 5          |

Note that that step is almost entirely generic, and everything after "Given the 
following..." is only used to get on the right page in the first place.  The 
form submission code doesn't actually know what it's creating.

Also, be sure to focus on the ultimate goal of the user in the interaction.  
It's unlikely the user is concerned with being able to edit fields; rather, 
they want to keep some data current for some reason.  This takes the steps from 
"Then I can input the value of <field>" closer to "When I have submitted 
<field>; Then I should see <field> updated" or some such.  Although, CRUDL is 
at such a low level that this example may seem contrived.

Another way to look at this is that the _ability_ to do something is implicit 
in the fact that _doing it_ produces the correct output.  So if submitting the 
form produces the desired effect, then submitting the form is clearly possible, 
and it's not (usually) necessary to check for signs that it might be possible.  
(This strategy relies on making the steps print good diagnostic info when 
something goes wrong.)

HTH.  Let me know if you have any questions.

Ashley


  Feature: Administrator updates ENTITYs
    So that I can define how OTHER ENTITY is presented 
    As an Administrator
    I want to update an ENTITY
  
    Scenario: Viewing update page
      Given the following ENTITY:
        | Name     | Style | Replacement |
        | Standard | L-R-R | R           |
      And I have logged in as '[email protected]'
      When I visit the Edit 'Standard' ENTITY page
      Then I should see 'Edit ENTITY'
  
    Scenario: Successful update
      Given the following ENTITY:
        | Name     | Style | Replacement |
        | Standard | L-R-R | R           |
      And I have logged in as '[email protected]'
      When I visit the Edit 'Standard' ENTITY page
      And I update an ENTITY by submitting the following details:
        | Name        | Style | Replacement |
        | Commutative | R-L-R | R           |
      Then I should be taken to the 'Commutative' ENTITY page
      And I should see 'updated successfully'
      And I should see the following ENTITY details:
        | Name        | Style | Replacement |
        | Commutative | R-L-R | R           |

    Scenario: Unsuccessful update with missing name
      Given the following ENTITY:
        | Name     | Style | Replacement |
        | Standard | L-R-R | R           |
      And I have logged in as '[email protected]'
      When I visit the Edit 'Standard' ENTITY page
      And I update an ENTITY by submitting the following details:
        | Name | Style | Replacement |
        |      | L-R-R | R           |
      Then I should see 'Edit ENTITY'
      And I should see 'Couldn't update ENTITY'
      And I should see 'Name must not be blank'



-- 
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran

--

You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nwrug-members?hl=en.


Reply via email to