Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include pickle name if parameterized #44

Merged
merged 1 commit into from
Jun 22, 2024

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented May 26, 2024

🤔 What's changed?

Cucumber originally only had Features with Scenarios. When Scenario
Outlines were added, it became hard to distinguish which example failed.
To work around this Scenario Outline may have placeholders in their
name. These placeholders are replaced when creating a pickle name. This
helps ensure that each scenario is unique.

Feature: Examples Tables

  Scenario Outline: Eating <eat> cucumbers
    Given there are <start> cucumbers
    When I eat <eat> cucumbers
    Then I should have <left> cucumbers

    Examples: These are passing
      | start | eat | left |
      |    12 |   5 |    7 |

This would be rendered as:

Examples Tables
  └── Eating 5 cucumbers

But with the addition of the Rule element and test frameworks supporting
hierarchical test structures it also becomes desirable to include the
structure of a feature file in the test name. So we would now
render:

Examples Tables
└── Eating cucumbers
    └──These are passing
        └── #1.1

And while this hierarchy is sufficient to identify a failed example, it
is not very easy to do so when there are many. So by including the
pickle name when the Scenario Outline is parameterized we can render:

Examples Tables
└── Eating <eat> cucumbers
    └──These are passing
        └── #1.1: Eating 5 cucumbers

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

📋 Checklist:

@mpkorstanje mpkorstanje force-pushed the include-pickle-name-if-parameterized branch from 72b1822 to d78f43e Compare June 21, 2024 13:26
@mpkorstanje mpkorstanje force-pushed the include-pickle-name-if-parameterized branch from 9c02efc to c84efe2 Compare June 22, 2024 13:17
@mpkorstanje mpkorstanje changed the title Include pickle name if paramterized Include pickle name if parameterized Jun 22, 2024
Cucumber originally only had Features with Scenarios. When Scenario
Outlines were added, it became hard to distinguish which example failed.
To work around this Scenario Outline may have placeholders in their
name. These placeholders are replaced when creating a pickle name. This
helps ensure that each scenario is unique.

```
Feature: Examples Tables

  Scenario Outline: Eating <eat> cucumbers
    Given there are <start> cucumbers
    When I eat <eat> cucumbers
    Then I should have <left> cucumbers

    Examples: These are passing
      | start | eat | left |
      |    12 |   5 |    7 |
```

This would be rendered as:

```
Examples Tables
  └── Eating 5 cucumbers
```

But with the addition of the Rule element and test frameworks supporting
hierarchical test structures it also becomes desirable to include the
structure of a feature file in the test name. So we would now
render:

```
Examples Tables
└── Eating cucumbers
    └──These are passing
        └── #1.1
```

And while this hierarchy is sufficient to identify a failed example, it
is not very easy to do so when there are many. So by including the
pickle name when the Scenario Outline is parameterized we can render:

```
Examples Tables
└── Eating <eat> cucumbers
    └──These are passing
        └── #1.1: Eating 5 cucumbers
```
@mpkorstanje mpkorstanje force-pushed the include-pickle-name-if-parameterized branch from c84efe2 to 108c963 Compare June 22, 2024 13:18
@mpkorstanje mpkorstanje marked this pull request as ready for review June 22, 2024 13:19
@mpkorstanje mpkorstanje merged commit f37e42b into main Jun 22, 2024
8 checks passed
@mpkorstanje mpkorstanje deleted the include-pickle-name-if-parameterized branch June 22, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant