pytest-dev / pytest-dev/pytest-bdd

--gherkin-terminal-reporter doesn't color steps correctly

Open
#214 1 comment 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The gherkin terminal reporter doesn't color the steps correctly.

Let's say I have the following feature with a broken step:

Scenario: Publishing the article
    Given I'm an author user
    And I have an article
    When I go to the article page  # This step is broken
    And I press the publish button
    Then I should not see the error message
    And the article should be published

I expect the output to look like this (the first word in each line is the colouring):

RED:   Scenario: Publishing the article
GREEN:     Given I'm an author user
GREEN:     And I have an article
RED:       When I go to the article page  # This step is broken
RED:       And I press the publish button
RED:       Then I should not see the error message
RED:       And the article should be published
RED:   FAILED

But instead I get an output with all lines in red.
Printing the steps after the failed one is optional.

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 by reproducing the example feature with --gherkin-terminal-reporter and inspect the gherkin terminal reporter entry point. Trace how step results are mapped to colors after the first failure. Done means the scenario and steps use the expected red/green output, with later steps optionally omitted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.