Skip to content

Commit

Permalink
show scenario(outline) keyword if name is empty (fixes allure-framewo…
Browse files Browse the repository at this point in the history
  • Loading branch information
sseliverstov authored and GilBecker-Anaplan committed Apr 10, 2023
1 parent 10b6a05 commit fa5cf67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 13 additions & 1 deletion allure-behave/features/scenario.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ Feature: Scenario
| passed | passed |
| failed | failed |
| broken | broken |
| undefined | broken |
| undefined | broken |


Scenario: Scenario without name
Given feature definition
"""
Feature: Scenario
Scenario:
Given passed step
"""
When I run behave with allure formatter
Then allure report has a scenario with name "Scenario"
4 changes: 3 additions & 1 deletion allure-behave/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
def scenario_name(scenario):
scenario_outlines = [so for so in scenario.feature if isinstance(so, ScenarioOutline)]
current_scenario_outline = next(iter(filter(lambda so: scenario in so.scenarios, scenario_outlines)), None)
return current_scenario_outline.name if current_scenario_outline else scenario.name
if current_scenario_outline:
return current_scenario_outline.name if current_scenario_outline.name else current_scenario_outline.keyword
return scenario.name if scenario.name else scenario.keyword


def scenario_history_id(scenario):
Expand Down

0 comments on commit fa5cf67

Please sign in to comment.