Skip to content

Commit fa5cf67

Browse files
sseliverstovGilBecker-Anaplan
authored andcommitted
show scenario(outline) keyword if name is empty (fixes allure-framework#70 via allure-framework#72)
1 parent 10b6a05 commit fa5cf67

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

allure-behave/features/scenario.feature

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,16 @@ Feature: Scenario
1919
| passed | passed |
2020
| failed | failed |
2121
| broken | broken |
22-
| undefined | broken |
22+
| undefined | broken |
23+
24+
25+
Scenario: Scenario without name
26+
Given feature definition
27+
"""
28+
Feature: Scenario
29+
30+
Scenario:
31+
Given passed step
32+
"""
33+
When I run behave with allure formatter
34+
Then allure report has a scenario with name "Scenario"

allure-behave/src/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
def scenario_name(scenario):
1919
scenario_outlines = [so for so in scenario.feature if isinstance(so, ScenarioOutline)]
2020
current_scenario_outline = next(iter(filter(lambda so: scenario in so.scenarios, scenario_outlines)), None)
21-
return current_scenario_outline.name if current_scenario_outline else scenario.name
21+
if current_scenario_outline:
22+
return current_scenario_outline.name if current_scenario_outline.name else current_scenario_outline.keyword
23+
return scenario.name if scenario.name else scenario.keyword
2224

2325

2426
def scenario_history_id(scenario):

0 commit comments

Comments
 (0)