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
Hello, I am using the Gherkin tags in the feature specification to refer scenarios to different software requirements and it would be really convenient to be able to get those tags printed when I run pytest with the --gherkin-terminal-reporter option. I know they are generated into the cucumber JSON but that's less human readable as of right now.
The feature looks like this:
@R1.1 @R1.2
Scenario: Send packages to socket
Given a service listening on a random socket
When tool sends "2" packages to socket
Then "2" packages are received in the service
So it would be great to get the tags formatted in some way in the output of the test:
$ pytest --gherkin-terminal-reporter -vv
===================================================================================== test session starts =====================================================================================
tests/pacsio_test.py::test_send_packages_to_socket <- utilities/pacs_io/.venv/lib/python3.8/site-packages/pytest_bdd/scenario.py
Feature: Tool for network testing
Scenario: Send packages to socket
Given a service listening on a random socket
When tool sends "2" packages to socket
Then "2" packages are received in the service
PASSED
(tags: R1.1, R1.2)
I'm trying to implement it as a feature (first-time contributor to OSS), but I'm having trouble with the test, if I define a test-case for it like this in feature/test_gherkin_terminal_reporter.py:
FEATURE_WITH_TAGS = """\
@feature_tag0 @feature_tag1
Feature: Gherkin terminal output feature
@scenario_tag0 @scenario_tag1
Scenario: Scenario example 1
Given there is a bar
When the bar is accessed
Then world explodes
"""
Then pytest throws this:
E pytest.PytestUnknownMarkWarning: Unknown pytest.mark.scenario_tag1 - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
I can't find a contributing guideline but I have something that works in my forked branch (minus the testing, which I can't get to properly work). How does the PR process work?
I have an implementation ready that prints scenario tags in both -v and -vv Gherkin terminal output, with coverage for both modes. I’ll open the PR now.
Correction: I found the existing #807 and #477 after checking the complete open-PR list, so I closed my duplicate #830. Sorry for overlooking those PRs in the initial issue-reference search.
Activity
guillego commentedon Jan 4, 2022
I'm trying to implement it as a feature (first-time contributor to OSS), but I'm having trouble with the test, if I define a test-case for it like this in
feature/test_gherkin_terminal_reporter.py:Then pytest throws this:
E pytest.PytestUnknownMarkWarning: Unknown pytest.mark.scenario_tag1 - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.htmlguillego commentedon Jan 4, 2022
I can't find a contributing guideline but I have something that works in my forked branch (minus the testing, which I can't get to properly work). How does the PR process work?
ryux1 commentedon Sep 6, 2026
I have an implementation ready that prints scenario tags in both
-vand-vvGherkin terminal output, with coverage for both modes. I’ll open the PR now.ryux1 commentedon Sep 6, 2026
Correction: I found the existing #807 and #477 after checking the complete open-PR list, so I closed my duplicate #830. Sorry for overlooking those PRs in the initial issue-reference search.