When writing cucumber's features, we have to really think like the end-user, and write stuff that end-users will understand.
When editing a user, the natural flow goes like this: " Given the following users exists in the system ... And I go to /users When I click on 'Edit' for Cathy Then I should go to 'Edit User' Page Given I fill in 'Name*' with 'Carol' When I click on 'Save' Then I should go to 'Manage Users' Page And I should see 'User successfully updated' And I should see Cathy updated as Carol " When creating a new user, the natural flow goes like this: " Given I go to /users When I click on 'New User' Then I should go to 'Create User' Page Given I fill in 'Name*' with 'Carol' And I fill in ... And I fill in ... When I click on 'Save' Then I should go to 'Manage Users' Page And I should see 'User successfully created' And I should see Carol " U can see the gist at http://gist.github.com/38355 Hope this helps to clear things up. :] TY == On Sat, Dec 20, 2008 at 11:42 PM, Jon Hancock <[email protected]> wrote: > > Thanks, I'll check out your salad ;). > As to the first issue, I think you make my point well. If you want to > push the implementation issues into the work steps or even lower, you > should not have the statement: > "When I go to /login" > Which states a specific path. What if the path is "/sessions/new". > What if the statement was: > "When I go to update a post" and because your following resource path > rules, the path is actually "/posts/123/edit". Do we train the people > writing the scenarios on the default naming of CRUD based resources? > How much magic do we need to put into the work steps to allow natural > language scenarios? > For many of us, the person writing the tests is also the developer and > there is little point in building too much abstraction. Either way, a > little abstraction is still useful. But to much abstraction? > This is why I like using the name of the route, as the real path is > already buried in implementation, your router.rb file. > > I recall very similar discussions when use cases started to become > popular in the early to mid 90s. The issue was "How much should the > use case language be natural language versus using nomenclature of the > developers?" It turns out the people writing use case are the same > people assisting with defining the object model and their names. This > is the perfect point where language needs to be bridged between user > and developer. It is where nomenclature gets defined and refined. > > thanks, Jon > > On Dec 20, 12:15 pm, "Tze Yang Ng" <[email protected]> wrote: >> Just voicing my thoughts: >> >> > 1 - Instead of "When I go to /login" I would like the option of >> > writing "When I go to login" or When I go to :login" whereby if I >> > don't pass in something that looks like a path, it will use the merb >> > url() method to to get the path by name. Does someone have a hacked >> > version of common_webrat.rb >> >> ME: personally i don't like this idea, cucumber's features is supposed >> to bridge the gap between developers (technical) and end-users >> (non-technical) ... an expression like "When I go to /login" is >> obvious to all parties abt the intention of the step, that is, >> accessing of "/login". >> >> Whereas "When I go to login" or "When I go to :login" don't, there is >> an additional layer introduced, the non-technical guys may ask, how do >> i go to "login" or ":login" ??? >> >> > 2 - Not sure the appropriate way to load sample data for cucumber >> > tests. Are these called fixtures in cucumber? What are others doing >> > here for datamapper test data? >> >> ME: Quite sometime ago, i done something >> athttp://github.com/ngty/ty_cucumber_salad, haven't got the chance to >> update it due to many other distractions in life. Anyway, u can find >> the answers to ur this particular question there. >> >> Cheers >> >> == >> >> >> >> On Sat, Dec 20, 2008 at 9:51 AM, Jon Hancock <[email protected]> wrote: >> >> > I finally have the basics of cucumber working with Scenario Outlines. >> > There are two things I need next: >> >> > 1 - Instead of "When I go to /login" I would like the option of >> > writing "When I go to login" or When I go to :login" whereby if I >> > don't pass in something that looks like a path, it will use the merb >> > url() method to to get the path by name. Does someone have a hacked >> > version of common_webrat.rb >> >> > 2 - Not sure the appropriate way to load sample data for cucumber >> > tests. Are these called fixtures in cucumber? What are others doing >> > here for datamapper test data? >> >> > thanks, Jon >> >> --http://ngty77.blogspot.com > > > -- http://ngty77.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" 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/merb?hl=en -~----------~----~----~----~------~----~------~--~---
