[rspec-users] Multi-line steps
pergesu at gmail.com
Wed Apr 9 17:04:33 EDT 2008
On 4/9/08, Ashley Moran <ashley.moran at patchspace.co.uk> wrote:
> On 9 Apr 2008, at 14:14, aslak hellesoy wrote:
> > Just a style comment: I usually strive for a single When (in this case
> > Fred uploads the csv file).
> > The other ones are Givens.
> Hmm, I've written a lot of Selenium stories lately, and they look like
> Given ...
> When the user visits /my_page
> And clicks on "Edit"
> And types "Cow" in the favourite_animal text field
> And clicks the save button
> Then ...
> Is that bad?
Not bad, but perhaps misleading. Given is used to express
preconditions, wheras When is for an action. Her you are expressing
preconditions, even if those preconditions are action-based instead of
state-based (e.g. the known state of the work is that the user has
performed these actions)
Does that make any sense?
More information about the rspec-users