Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Building up queries/Transactions in Gherkin Scenarios.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mswinson  
View profile  
 More options Feb 26 2012, 12:07 am
From: mswinson <mswin...@btinternet.com>
Date: Sat, 25 Feb 2012 21:07:23 -0800 (PST)
Local: Sun, Feb 26 2012 12:07 am
Subject: Building up queries/Transactions in Gherkin Scenarios.

Hi,

I want to write the following type of scenario, which if you picture
it behind the scenes
is building up a task which is then to be run before returning
results.

When I search for x
With a filter of x
And a filter of x
Then I receive results containing y

A number of problems:
1) the With keyword does'nt exist, but I read somewhere that Gherkin
supports aliasing, so this is
something I might look into.
2) If I'm building up a search request in this way, what I have is
that the first three steps
implicitly translate to one transaction behind the scenes (an HTTP
request). Is what I'm
testing at fault, or do I need to simple rephrase what I'm trying to
test.

e.g:

When I want to search for a list of 'x'
And I use a keyphrase of 'keyphrase'
And a filter of 'filter1'
And a filter of 'filter2'
And I submit my search to 'server'
Then I should receive results containing y

What would be going on in terms of implementation details, is that the
first 4 steps would
be building a query request ( e.g an HTTP query string ), and step 5
would essentially forward
the request to the search server.

This seems to work and read better, but I'm not sure if its the sort
of thing I should be doing with gherkin?

Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Lawrence  
View profile  
 More options Feb 26 2012, 12:35 am
From: Richard Lawrence <rich...@humanizingwork.com>
Date: Sat, 25 Feb 2012 22:35:19 -0700
Local: Sun, Feb 26 2012 12:35 am
Subject: Re: [Cucumber:10549] Building up queries/Transactions in Gherkin Scenarios.
How about:

When I search for X with filters:
| filter |
| Y |
| Z |

or, if the filter names are short:

When I search for X with filters Y, Z, and Q

Richard


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andy Waite  
View profile  
 More options Feb 26 2012, 6:07 am
From: Andy Waite <andywa...@gmail.com>
Date: Sun, 26 Feb 2012 03:07:29 -0800 (PST)
Local: Sun, Feb 26 2012 6:07 am
Subject: Re: Building up queries/Transactions in Gherkin Scenarios.

On Feb 26, 5:35 am, Richard Lawrence <rich...@humanizingwork.com>
wrote:

> How about:

> When I search for X with filters:
> | filter |
> | Y |
> | Z |

> or, if the filter names are short:

A little tip - if a table only has a single column, you can leave out
the header row and use table.raw.flatten to turn it into an array.

Andy


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Premdas  
View profile  
 More options Feb 26 2012, 9:41 am
From: Andrew Premdas <aprem...@gmail.com>
Date: Sun, 26 Feb 2012 14:41:22 +0000
Local: Sun, Feb 26 2012 9:41 am
Subject: Re: [Cucumber:10549] Building up queries/Transactions in Gherkin Scenarios.

On 26 February 2012 05:07, mswinson <mswin...@btinternet.com> wrote:

Fundamentally gherkin is about expressing business needs, not about listing
implementation details. What you should do is find a name for x with a
filter of x and x. Then you can just have

When I search for foo
Then I should see results for foo

This is just so much easier to implement, and the feature has less noise.
All the detail about the filters is delegated down to the step definitions,
and ideally down to your actual source. For example if this was a Rails app
you would use foo to define a scope and then have you search use the scope.
Now instead of having the scope defined in two places (the text of your
feature and you source) you are only using the definition in your code.

If you really want to assemble  something in gherkin then you can
communicate between steps in a number of ways

1) Use a variable e.g @search
2) Put something in a database and then retrieve it using last in
subsequent steps e.g. Search.last (this relies on the database being
emptied between scenarios)
3) Identify the thing in the feature and then use the id to retrieve e.g.
When I create a foo search,  And I add a filter to foo and then
Search.find('foo') in subsequent steps

Variables can be very elegant, especially for feature text but their
overuse can quickly cause chaos (their globals after all)
Using last is fine, until you add something else into the database by
mistake e.g. using a related factory with a side effect
Using an identity is safest but uglifies your features

HTH

Andrew

--
------------------------
Andrew Premdas
blog.andrew.premdas.org

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »