Skip to content

[JUnit Platform Engine] Use number-and-pickle-if-parameterized strategy #3004

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

Merged
merged 1 commit into from
May 29, 2025

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented May 29, 2025

⚡️ What's your motivation?

Given a feature with parameterized and unparameterized examples:

Feature: Examples Tables

  Scenario Outline: Eating 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 |
      |    20 |   5 |   15 |

    Examples: These are failing
      | start | eat | left |
      |    12 |  20 |    0 |
      |     0 |   1 |    0 |

  Scenario Outline: Eating <color> cucumbers
    Given I am transparent
    When I eat <color> cucumbers
    Then I become <color>

    Examples:
      | color |
      |   red |
      | green |
      |  blue |

When the scenario name is parameterized, instead of only numbering the examples, the interpolated scenario name is also included.

Examples Tables
 - Eating cucumbers
   - These are passing
     - Example #1.1
     - Example #1.2
  - These are failing
  - Eating <color> cucumbers
   - Examples
    - Example #1.1: Eating red cucumbers
    - Example #1.2: Eating green cucumbers
    - Example #1.3: Eating blue cucumbers

🏷️ What kind of change is this?

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

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

Given a feature with parameterized and unparameterized examples:

```feature
Feature: Examples Tables

  Scenario Outline: Eating 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 |
      |    20 |   5 |   15 |

    Examples: These are failing
      | start | eat | left |
      |    12 |  20 |    0 |
      |     0 |   1 |    0 |

  Scenario Outline: Eating <color> cucumbers
    Given I am transparent
    When I eat <color> cucumbers
    Then I become <color>

    Examples:
      | color |
      |   red |
      | green |
      |  blue |
```

When the scenario name is parameterized, instead of only numbering the
examples, the interpolated scenario name is also included.

```
Examples Tables
 - Eating cucumbers
   - These are passing
     - Example #1.1
     - Example #1.2
  - These are failing
  - Eating <color> cucumbers
   - Examples
    - Example #1.1: Eating red cucumbers
    - Example #1.2: Eating green cucumbers
    - Example #1.3: Eating blue cucumbers
```
@mpkorstanje mpkorstanje merged commit 7960abd into main May 29, 2025
6 checks passed
@mpkorstanje mpkorstanje deleted the feature/pickl-if-parameterized branch May 29, 2025 16:43
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