A powerful Reqnroll generator plugin that enables calling and embedding scenarios from other feature files directly within your test scenarios. This plugin promotes test reusability, modularity, and better organization of your Gherkin specifications.
- 🔄 Scenario Reusability: Call existing scenarios from any feature file
- 🎯 Inline Expansion: Automatically expands scenario calls during test generation
- 🗂️ Cross-Feature Support: Reference scenarios across different feature files
- 🚀 Cross-Project Support: Automatically discovers and calls scenarios from referenced projects
- 🏗️ Build-Time Processing: No runtime overhead - scenarios are expanded at build time
- 🛡️ Error Handling: Graceful handling of missing scenarios with clear warnings
- 📁 Automatic Discovery: Automatically finds feature files in referenced projects - no manual copying needed
- 🌍 Multi-Language Support: Supports all Gherkin languages (English, German, French, Spanish, Dutch, and more)
Use the following syntax to call scenarios from other features:
Given I call scenario "ScenarioName" from feature "FeatureName"
When I call scenario "ScenarioName" from feature "FeatureName"
Then I call scenario "ScenarioName" from feature "FeatureName"
And I call scenario "ScenarioName" from feature "FeatureName"
But I call scenario "ScenarioName" from feature "FeatureName"See the examples folder for complete working examples:
- examples/BasicUsage - Feature file examples showing the syntax
- examples/MSTestExample - Complete MSTest project example with step definitions
Authentication.feature
Feature: Authentication
As a user
I want to be able to login and logout
So that I can access the application securely
Scenario: Login
Given I am on the login page
When I enter valid credentials
Then I should be logged in successfully
Scenario: Logout
Given I am logged in
When I click the logout button
Then I should be logged outUserManagement.feature
Feature: User Management
As an administrator
I want to manage user accounts
So that I can control access to the system
Scenario: Create New User Account
Given I call scenario "Login" from feature "Authentication"
When I navigate to user management
And I create a new user account
Then the user should be created successfully
And I call scenario "Logout" from feature "Authentication"The scenario call is automatically expanded during build time:
Scenario: Create New User Account
# Expanded from scenario call: "Login" from feature "Authentication"
Given I am on the login page
When I enter valid credentials
Then I should be logged in successfully
When I navigate to user management
And I create a new user account
Then the user should be created successfully
# Expanded from scenario call: "Logout" from feature "Authentication"
Given I am logged in
When I click the logout button
Then I should be logged outInstall the plugin via NuGet Package Manager:
dotnet add package JGerits.Reqnroll.ScenarioCall.GeneratorOr via Package Manager Console in Visual Studio:
Install-Package JGerits.Reqnroll.ScenarioCall.Generator- Download the latest release from the releases page
- Add the assembly reference to your test project
- Ensure the plugin is registered (see Configuration section)
The plugin automatically registers itself with Reqnroll when referenced in your project. No additional configuration is required for basic usage.
The plugin automatically searches for feature files in the following locations relative to your project:
- Current directory
Features/folderSpecs/folderTests/folder
All searches include subdirectories recursively.
MyProject/
├── Features/
│ ├── Authentication.feature
│ ├── UserManagement.feature
│ └── Shopping/
│ ├── Cart.feature
│ └── Checkout.feature
├── Specs/
│ └── Integration/
│ └── EndToEnd.feature
└── Tests/
└── Smoke/
└── SmokeTests.feature
Call scenarios from other projects in your solution - perfect for sharing common test scenarios across multiple test projects!
Setup:
- Add a project reference to the shared library:
<ItemGroup>
<ProjectReference Include="..\SharedAuthLibrary\SharedAuthLibrary.csproj" />
</ItemGroup>- Call scenarios from the referenced project:
Feature: Order Management
Scenario: Place Order as Authenticated User
Given I call scenario "Login with Valid Credentials" from feature "Shared Authentication"
When I navigate to the products page
And I proceed to checkout
Then I should see order confirmationHow it works:
- The plugin automatically discovers feature files from referenced projects
- No manual file copying or complex MSBuild configuration needed
- Scenarios are expanded at build time just like same-project calls
- Step definitions from referenced projects are available through dependency injection
Example: See examples/MSTestCrossProjectExample for a complete working example.
When a scenario call cannot be resolved, the plugin adds a warning comment instead of failing the build:
Scenario: Test with Missing Reference
Given I call scenario "NonExistent" from feature "Missing"
# Warning: Could not expand scenario callScenarios can contain calls to other scenarios, enabling complex composition:
BaseOperations.feature
Feature: Base Operations
Scenario: Setup Test Environment
Given the application is started
And the database is clean
Scenario: Complete Login Flow
Given I call scenario "Setup Test Environment" from feature "Base Operations"
When I call scenario "Login" from feature "Authentication"
Then I should see the dashboard- Feature names are case-insensitive
- Scenario names are case-insensitive
- File discovery is case-insensitive
The plugin supports all Gherkin languages that Reqnroll supports. Specify the language using the # language: directive at the top of your feature file.
Dutch Example (AuthenticatieNL.feature)
# language: nl
Functionaliteit: Authenticatie
Scenario: Inloggen met geldige inloggegevens
Gegeven ik ben op de inlogpagina
Als ik gebruikersnaam "[email protected]" invoer
En ik wachtwoord "SecurePassword123" invoer
Dan zou ik ingelogd moeten zijnUsing Dutch scenarios in your feature files:
# language: nl
Functionaliteit: Gebruikersbeheer
Scenario: Nieuw gebruikersaccount aanmaken
Gegeven I call scenario "Inloggen met geldige inloggegevens" from feature "Authenticatie"
Als ik naar het gebruikersbeheersectie navigeer
Dan zou ik de gebruikerslijst moeten zienGerman Example (AuthentifizierungDE.feature)
# language: de
Funktionalität: Authentifizierung
Szenario: Login mit gültigen Anmeldedaten
Angenommen ich bin auf der Login-Seite
Wenn ich Benutzername "[email protected]" eingebe
Und ich Passwort "SecurePassword123" eingebe
Dann sollte ich eingeloggt seinUsing German scenarios in your feature files:
# language: de
Funktionalität: Benutzerverwaltung
Szenario: Neues Benutzerkonto erstellen
Angenommen I call scenario "Login mit gültigen Anmeldedaten" from feature "Authentifizierung"
Wenn ich zum Benutzerverwaltungsbereich navigiere
Dann sollte ich die Benutzerliste sehenSupported Languages: English (en), Dutch (nl), German (de), French (fr), Spanish (es), and many more. See Gherkin language reference for a complete list.
Mixed Language Support: You can call scenarios from feature files written in different languages. The plugin automatically detects the language of each feature file.
- .NET Standard 2.0 or higher
- Reqnroll (compatible with SpecFlow migration)
- MSBuild or .NET CLI for build-time processing
Issue: Scenario not found
# Warning: Could not expand scenario call
Solution:
- Verify the feature name matches the
Feature:declaration exactly - Ensure the scenario name exists in the target feature file
- Check that the feature file is in a discoverable location
Issue: Infinite recursion Solution: Avoid circular references between scenario calls. The plugin does not currently detect circular dependencies.
Issue: Feature file not found Solution:
- Ensure feature files are included in the project build
- Verify the feature file path is in one of the searched directories
- Check file naming conventions (
.featureextension required)
- Check the generated test files to see expanded scenario content
- Enable verbose MSBuild logging to see plugin activity
- Verify feature file discovery paths match your project structure
- Circular scenario call references are not detected
- Scenario Outline templates cannot be called directly (use regular Scenario: instead)
- Scenario calls in
Background:sections are not expanded (only inScenario:sections) - Nested scenario calls are not recursively expanded (scenario calls within called scenarios remain as-is)
- Parameters cannot be passed between called scenarios
- Background steps are not included in scenario calls
We welcome contributions! Please see our Contributing Guidelines for details.
- Clone the repository
- Install .NET 8.0 SDK or higher
- Restore packages:
dotnet restore - Build:
dotnet build - Run tests:
dotnet test
# Run all tests
dotnet test
# Run tests with verbose output
dotnet test --verbosity normal
# Run specific test
dotnet test --filter "TestMethodName"- Initial release
- Basic scenario calling functionality
- Automatic feature file discovery
- Error handling for missing scenarios
- Support for all Gherkin step keywords
This project uses GitHub Actions for automated building, testing, and publishing to NuGet.org.
The pipeline automatically:
-
On every push to main/master and pull requests:
- Sets up .NET 8.0 environment
- Restores NuGet dependencies
- Builds the solution in Release configuration
- Runs all tests
- Creates NuGet packages
- Uploads packages as build artifacts
-
On every push to main/master (automatic releases):
- Automatically increments the patch version (e.g., 3.0.0 → 3.0.1)
- Updates version numbers in the project file
- Builds and tests with the new version
- Creates a GitHub release with the new tag
- Attaches the NuGet package to the release
-
On GitHub releases:
- Downloads the build artifacts
- Publishes the NuGet package to nuget.org
New in this version: Every commit to the main branch now automatically creates a new release!
The versioning follows the pattern described in the CHANGELOG.md:
- MAJOR.MINOR: Matches the Reqnroll version (e.g., 3.0 for Reqnroll 3.0.x)
- PATCH: Automatically incremented on each commit to main (3.0.0 → 3.0.1 → 3.0.2, etc.)
Automatic Process (recommended):
- Simply push changes to the main branch
- The CI/CD pipeline will automatically:
- Increment the patch version
- Create a GitHub release
- Publish to NuGet.org
Manual Process (for major/minor version changes):
- Update the version in
Reqnroll.ScenarioCall.Generator.csproj:<Version>4.0.0</Version> <AssemblyVersion>4.0.0</AssemblyVersion> <FileVersion>4.0.0</FileVersion>
- Commit and push to main
- The pipeline will use your specified version instead of auto-incrementing
To enable automatic publishing, the repository requires a NUGET_API_KEY secret containing a valid NuGet.org API key with push permissions.
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
- 📫 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📚 Documentation: This README and inline code documentation
- Reqnroll - The .NET BDD framework this plugin extends
- SpecFlow - The original framework (Reqnroll is the successor)
Made with ❤️ for the BDD community