I'm using cucumber to generate test scripts that can be executed by a tool or human... so not the standard use.
However I would like to pass through the scenario and example names through to my output.
Is this possible?
I'm using cucumber to generate test scripts that can be executed by a tool or human... so not the standard use.
However I would like to pass through the scenario and example names through to my output.
Is this possible?
I don't know off hand, but from what I know of cucumber it's probably something like:
Given that you know the scenario and example names
and I want to know the scenario and example names
could you Give the scenario and example names
to me
please
Of course, there's some punctuation missing...
A more serious answer (or at least, suggestion): make use of ruby's reflection to try to find what you are looking for. Grab likely objects, find out what methods they have, and see if you can find it. For example:
File.open('happy_hunting.log','a') { |f|
f.print "Scenario supports: #{(scenario.methods - Object.methods).inspect}\n"
}
and then repeat it to figure out whats where.
Another suggestion, look at the source.
Found it.. (with some help from Tim Walker)
Before do |scenario|
puts "Before Scenario: #{scenario.to_sexp[2]}"
.
.
.
end
Your SExpression may differ, so it's worth doing a scenario.to_sexp.inspect
to see what that tree is.
Aslak is keen to avoid exposing properties on his classes (which is a decision I happen to agree with, so I'm happy to do this work around).