pytest-dev / pytest-dev/pytest-bdd

print tags in gherkin-terminal-reporter

Open
#476 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature good first issue
Dominant language
Python
Stars
1.5k
Forks
251
Avg merge
43m
Merged PRs (30d)
2

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the --gherkin-terminal-reporter entry point and compare its output with the tags already present in cucumber JSON. Trace how the shown scenario.py output is assembled, then add human-readable tags to terminal output and verify pytest -vv displays them for tagged scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.