You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Referencing a parameter type that isn't defined doesn't give me an error, nor does it suggest that I need to define a parameter type.
Expected Behavior
Given the following source:
Given leg LHR-OSL is cancelled
Given('leg LHR-OSL is cancelled')dologdate.to_send
When I change the Cucumber Expression to:
Given('leg {flight-leg} is cancelled')dologdate.to_send
Then I would expect:
The parameter flight-leg is not defined. You can define a new one with:
ParameterType(
name: 'flight-leg',
regexp: /some regexp here/,
type: FlightLeg,
# The transformer takes as many arguments as there are capture groups in the regexp,
# or just one if there are none.
transformer: ->(s) { FlightLeg.new(s) }
)
Or alternatively (not as user friendly) just an error:
Could not parse Cucumber Expression "leg {flight-leg} is cancelled" because flight-leg
is not a known parameter type. Please define it.
Current Behavior
No error, no parameter type snippet. The Gherkin step is considered undefined and a step definition snippet is printed:
You can implement step definitions for undefined steps with these snippets:
Given('leg LHR-OSL is cancelled') do
pending # Write code here that turns the phrase above into concrete actions
end
Possible Solution
I haven't looked at the code, but I assume Cucumber is ignoring and swallowing an exception from cucumber-expressions when trying to parse the expression with the undefined type.
It should emit an UndefinedParameterType message on the bus, and this should be handled at the end of the run to print a parameter type snippet.
Context & Motivation
We want to make it easier for people to define parameter types, and we should give them as much help as possible. Ignoring errors is confusing for users.
Your Environment
Version used: 4.0.0.rc.6
Operating System and version: MacOS
Link to your project:
The text was updated successfully, but these errors were encountered:
It should emit an UndefinedParameterType message on the bus, and this should be handled at the end of the run to print a parameter type snippet.
Note: there's a message emitted in that case but it is directly an enveloppe, so only the message and html formatter are looking at those right now.
I'll add a more "classic" event in such case that can be listened by the other formatters.
Summary
Referencing a parameter type that isn't defined doesn't give me an error, nor does it suggest that I need to define a parameter type.
Expected Behavior
Given the following source:
Given leg LHR-OSL is cancelled
When I change the Cucumber Expression to:
Then I would expect:
Or alternatively (not as user friendly) just an error:
Current Behavior
No error, no parameter type snippet. The Gherkin step is considered undefined and a step definition snippet is printed:
Possible Solution
I haven't looked at the code, but I assume Cucumber is ignoring and swallowing an exception from cucumber-expressions when trying to parse the expression with the undefined type.
It should emit an
UndefinedParameterType
message on the bus, and this should be handled at the end of the run to print a parameter type snippet.Context & Motivation
We want to make it easier for people to define parameter types, and we should give them as much help as possible. Ignoring errors is confusing for users.
Your Environment
4.0.0.rc.6
The text was updated successfully, but these errors were encountered: