I've looked through the Ruby Gherkin source a bit and it doesn't look like there is a straightforward way to know which keyword was used once you are in a step definition. Am I missing something? Is there a way to do this? Even if it is bit of a hack?
Gherkin:
Then I say 'Hello World'
Step Definition:
When /I say 'Hello World'/ do
keyword_used = # FIXME how do I know what keyword was used in the Gherkin statement?
end
Edit: I'm adding the X for the Y...
The reason I am asking about this is that I am working with a group of people who want to do requirements capture in a fairly natural language sort of way (so, Gherkin) but then want to pump those requirements into something like ReqIF. For the use case at hand, it is important to retain a distinction between preconditions, trigger, and expected result. It is easy enough to adopt conventions for writing Gherkin that make this clear, e.g. all steps from the first step using keyword 'Given' to the last step before the first step using 'When' are preconditions. My step definitions do the work of shepherding the steps into the conversion to ReqIF. So, we're not actually using Cucumber to run tests, it is just a convenient apparatus for collecting and processing use cases / requirements expressed in Gherkin.