I'm not sure I made my goal clear. Let's say I have
| first_name | last_name | ...
| Ichabod | Crane | ...
....
I didn't understand from your first couple of emails that you were
using Scenario Outline and Examples tables. Now your question makes
more sense to me.
The term "placeholder name" isn't a term that conveys much contextual
meaning, although I know it's mentioned in the Scenario Outline wiki
page.
I suggest we use a different name for this. How about "Scenario
Outline parameter"?
Let's also assume I have been careful to use the names of my form
inputs as the names of my placeholders. Then I would like to be able
"And I type "<first_name>,...",
Given /^I type "([^\"]*)" ' do |value|
fill placeholder :with => value # expression 1
end
What if I have something like this:
Scenario Outline: Eat veggies
Given I have <n> green <name> in my belly
Examples:
|n|name|
|7|potatoes|
|4|cukes|
And a step definition:
Given /I have (.*) green (.*) in my belly/ do |n, name|
# What would you expect the placeholder method to return in this case?
end
Aslak
where the variable 'placeholder' would be assigned the value
'first_name' in the closure, or context in which expression (1) is
'And I type "<first_name>" into field "first_name"'...
'Given /^I type "([^\"]*)" into field "([^\"]*)"/ do |value,
name| ...'
which works fine, but requires more typing, and thus has more
opportunity for error.
Just a suggestion for a future release.
Post by Mike SassakPost by lsidenThe placeholder names are the same as the field names, so there is no
need to guess if I can find a way to access the placeholder name.
Otherwise, I will have to type 20 nearly identical steps definitions.
Guess I'll get started now, and use your answer, if I can, another
time.
Hi Larry,
Do you mean the placeholder in a Scenario Outline step? If that's the
Given I fill in "<placeholder>" with "<value>"
which should use the values from the examples table for placeholder
and value, and match the Webrat step definition.
Mike
Post by lsidenPost by aslak hellesoyAslak, in a step definition, is it possible for me to access the placeholder
name?
Given /^I type in "([^"]*)",$/ do |value|
fill_in <placeholder_name>, :with => value
end
Here, the placeholder_name is also the name of the field I want to fill in.
I don't think I understand the question. You want Cucumber to guess
what text field you're typing into?
Aslak
Thank you,
P.S. No need to email me directly or address questions to me
personally - I'm subscribed to the cukes list along with 500 other
people, and many of them can answer questions too ;-)
Larry Siden
http://umich.edu/~lsiden
734-926-9614
skype: lsiden
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group athttp://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to cukes+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=.