Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

Background sections can now expand scenario calls, both within the same feature and across features.

Changes

Core Generator (ScenarioCallFeatureGenerator.cs)

  • Extended PreprocessFeatureContent to detect and expand scenario calls in Background: sections using Gherkin's BackgroundKeywords
  • Renamed tracking variables from inScenario to inScenarioOrBackground for clarity

Tests (ScenarioCallFeatureGeneratorSimpleTests.cs)

  • Updated existing Background test to verify expansion (was testing non-expansion)
  • Added coverage for: same-feature calls, cross-feature calls, multiple calls, expansion ordering, and shared backgrounds

Documentation (README.md)

  • Removed Background limitation from documented constraints

Example

Feature: User Management
Background:
    Given I call scenario "Setup" from feature "Common"

Scenario: Create User
    When I create a user
    Then the user exists

The Background scenario call now expands inline before each scenario, equivalent to:

Background:
    # Expanded from scenario call: "Setup" from feature "Common"
    Given the database is initialized
    And the test user is created
Original prompt

This section details on the original issue you should resolve

<issue_title>Allow scenario calls from Background sections (including across features)</issue_title>
<issue_description>It is currently not possible to call a scenario defined in another feature file from within a Background section.

Current situation:

Expected functionality:

  • Scenario calls should be expanded inside Background sections as well, not only inside Scenario sections.
  • This should work both:
    • within the same feature file, and
    • across feature files.

Implementation hint:

  • Extend preprocessing so that it scans and expands scenario call lines inside Background blocks too.
  • Add tests for:
    • correct expansion order (Background steps first, then Scenario steps),
    • cross-feature background calls,
    • recursion protection (Background -> Scenario -> Background …).</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: jgerits <6541449+jgerits@users.noreply.github.com>
Copilot AI changed the title [WIP] Allow scenario calls from Background sections across features Enable scenario calls in Background sections Dec 19, 2025
Copilot AI requested a review from jgerits December 19, 2025 08: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.

Allow scenario calls from Background sections (including across features)

2 participants