[rspec-users] [cucumber] Features with multiple user iterations ¿?
joshuachisholm at gmail.com
Thu Jan 22 05:41:21 EST 2009
> Would you avoid the brittleness that "clicks submit link|button" has over "I submit".
There are often many ways of submitting on the same page. So to avoid
tying "I submit" to a particular scenario, I tend to use "I click
'submit'", which doesn't correspond to a link or button specifically,
but to "a link, button, or label with the text 'submit' -- and raise
an error if it's ambiguous". Is that too vague? As a human, if I were
told to "click 'submit'" I think I would apply the same reasoning.
On Thu, Jan 22, 2009 at 5:06 AM, Andrew Premdas <apremdas at gmail.com> wrote:
> Assuming that your steps are focused on using DOM Id's what sort of
> convention would you use to translate from the narrative of the step to the
> DOM id.
> Would you avoid the brittleness that "clicks submit link|button" has over "I
> submit". Thats me arguing that whether its a link or a button, and whether
> the user submits by clicking, pressing enter or barking is not relevant to
> the scenario.
> 2009/1/21 David Chelimsky <dchelimsky at gmail.com>
>> On Wed, Jan 21, 2009 at 9:27 AM, aidy lewis <aidy.lewis at googlemail.com>
>> > Hi David,
>> > On 21/01/2009, David Chelimsky <dchelimsky at gmail.com> wrote:
>> >> text on the button that is deemed to have business value, then you
>> >> might say "And I click 'Request Service'" - but if you're referencing
>> >> DOM IDs or HTML element names like 'submit', I'd hide those.
>> > However we could get a lot of re-use in the user steps if we have
>> > step definitions like these:
>> > When /^clicks '(+)' link$/ do |text|
>> > browser.link(:text, Regexp.new(value)).click
>> > end
>> > When /^clicks '(+)' button$/ do |text|
>> > browser.button(:value, Regexp.new(value)).click
>> > end
>> > When clicks 'Submit' link
>> > When clicks 'Submit' button
>> > When clicks 'New' link
>> > When clicks 'New' button
>> The important part of what I was saying was to avoid hidden elements
>> (DOM IDs and element names). If the label that is visible in the
>> browser says "Submit", then this is OK IMO.
>> > I personally don't think it is a crime for the tester to change the
>> > acceptance steps as long as the 'user' can easily follow the
>> > narrative.
>> Don't worry, you're not under arrest. At least not for this transgression
>> > A lot of the other user-steps could be wrapped-up in a more
>> > 'declarative' fashion.
>> > Aidy
>> rspec-users mailing list
>> rspec-users at rubyforge.org
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users