Describe the bug
Scenario versus ScenarioOutline detection logic in behave/runner.py is extremely brittle
because it relies on English keyword "Scenario".
This solution will not work in other languages except in English.
In addition, by now Gherkin supports multiple aliases for Scenario (even in English language).
Therefore, it is better to check is-instance-of(Scenario) instead of checking the keyword, like:
# -- FILE: behavex/runner.py
from behave.model import ScenarioOutline # ADDED
...
def create_scenario_line_references(features):
...
for feature in features:
...
for scenario in feature.scenarios:
# ORIG: if scenario.keyword == u'Scenario': # -- PROBLEM-POINT was here
if not isinstance(scenario, ScenarioOutline): # NEW_SOLUTION_HERE
feature_lines[scenario.name] = scenario.line
else:
...
To Reproduce
Steps to reproduce the behavior:
Run behavex features against the behave/tools/test-features/french.feature (using keyword: Scénario (with accept)
File "/.../behavex/runner.py", line 2xx, in create_scenario_line_references
for scenario_multiline in scenario.scenarios:
AttributeError: 'Scenario' object has no attribute 'scenarios'
Expected behavior
Scenario detection logic should be independent of keywords and should work for any language.
Describe the bug Scenario versus ScenarioOutline detection logic in
behave/runner.py
is extremely brittle because it relies on English keyword "Scenario". This solution will not work in other languages except in English. In addition, by now Gherkin supports multiple aliases for Scenario (even in English language). Therefore, it is better to checkis-instance-of(Scenario)
instead of checking the keyword, like:To Reproduce Steps to reproduce the behavior:
behavex features
against thebehave/tools/test-features/french.feature
(using keyword:Scénario
(with accept)Expected behavior Scenario detection logic should be independent of keywords and should work for any language.
Version Info: