Eric Pierce
2010-11-19 02:14:32 UTC
I really dig Cucumber's support for building complex steps out of
simpler ones, but sometimes I wish there was an option to "expand"
those inner steps when they are executed, especially those times when
I have a bug in an inner step--the backtrace can be pretty useless.
What I would like to see is either a command-line option, or something
similar to the 'steps' method (maybe 'macro'?) with a multiline
string, such that when I have a feature like this:
Given ABC
Then DEF
And step definitions:
Given /^ABC$/ do
macro %Q{
Given A
And B
And C
}
end
Then /^DEF$/ do
macro %Q{
Then D
And E
And F
}
end
When I run this feature, I'd like to see this output:
Given A
And B
And C
Then D
And E
And F
Or even:
Given ABC
Given A
And B
And C
Then DEF
Then D
And E
And F
In other words, the ABC and DEF steps are just stand-ins for the fully-
expanded inner steps. Nearly identical to the 'steps' syntax, but
evaluated as if the inner steps had been explicitly included in
the .feature file.
The topic of macros was touched upon in an older thread ("Mixing ruby
code and steps %Q{ } in a step definition?") but I have not seen
mention of expanding the steps in the output as I've described above.
I've started poking through the Cucumber code and thinking of ways to
implement this, but I am wondering if anyone else has interest in such
a feature, and also whether it has been discussed or attempted before.
Thoughts?
simpler ones, but sometimes I wish there was an option to "expand"
those inner steps when they are executed, especially those times when
I have a bug in an inner step--the backtrace can be pretty useless.
What I would like to see is either a command-line option, or something
similar to the 'steps' method (maybe 'macro'?) with a multiline
string, such that when I have a feature like this:
Given ABC
Then DEF
And step definitions:
Given /^ABC$/ do
macro %Q{
Given A
And B
And C
}
end
Then /^DEF$/ do
macro %Q{
Then D
And E
And F
}
end
When I run this feature, I'd like to see this output:
Given A
And B
And C
Then D
And E
And F
Or even:
Given ABC
Given A
And B
And C
Then DEF
Then D
And E
And F
In other words, the ABC and DEF steps are just stand-ins for the fully-
expanded inner steps. Nearly identical to the 'steps' syntax, but
evaluated as if the inner steps had been explicitly included in
the .feature file.
The topic of macros was touched upon in an older thread ("Mixing ruby
code and steps %Q{ } in a step definition?") but I have not seen
mention of expanding the steps in the output as I've described above.
I've started poking through the Cucumber code and thinking of ways to
implement this, but I am wondering if anyone else has interest in such
a feature, and also whether it has been discussed or attempted before.
Thoughts?
--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.