Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions allure-behave/src/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def stop_scenario(self, scenario):
should_drop_excluded = self.hide_excluded and (scenario.skip_reason == TEST_PLAN_SKIP_REASON or not should_run)

if should_drop_skipped_by_option or should_drop_excluded:
self.steps.clear()
self.logger.drop_test(self.current_scenario_uuid)
else:
status = scenario_status(scenario)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from hamcrest import assert_that, all_of, not_
from tests.allure_behave.behave_runner import AllureBehaveRunner
from allure_commons_test.report import has_test_case
from allure_commons_test.result import with_status
from allure_commons_test.result import has_title, with_status, with_steps


def test_behave_tags_filter(docstring: str, behave_runner: AllureBehaveRunner):
Expand Down Expand Up @@ -62,3 +62,41 @@ def test_behave_no_skipped_support(docstring: str, behave_runner: AllureBehaveRu
)
)
)


def test_hidden_tag_excluded_scenario_steps_are_not_reported(
docstring: str,
behave_runner: AllureBehaveRunner
):
"""Feature: Behave hidden tag-excluded scenario support

Scenario: Scenario without tag
Given an excluded step

@tag
Scenario: Scenario with tag
Given an included step
"""
behave_runner.run_behave(
feature_literals=[docstring],
step_literals=[
"given('an excluded step')(lambda c:None)\n"
"given('an included step')(lambda c:None)"
],
options=["--tags=tag", "-D", "AllureFormatter.hide_excluded=True"]
)
assert_that(
behave_runner.allure_results,
all_of(
not_(
has_test_case("Scenario without tag")
),
has_test_case(
"Scenario with tag",
with_status("passed"),
with_steps(
has_title("Given an included step")
)
)
)
)
Loading