Execute the same .feature
file with different parameters? Seeking for a Background Outline
-like functionality.
#2223
Replies: 2 comments
-
Gherkin isn't a programming language, so doing programming things in it isn't possible. And this take a bit of shift in thinking. It sounds like you have a widget that supports a set of features and is available on several pages. And you want to know if the full Cartesian product of supported features and pages works correctly. That seems exhaustive. And kinda slow. If instead you wanted to know if the widget works and if it is available on multiple pages you could write a feature that says as much: Scenario: The widgets works
Given an admin user
When the admin uses the widget
Then the widget works
... Repeat in detail for all use cases
Scenario: The widgets is available on multiple pages
Given an admin user
Then the widget is available on these pages
| Home |
| Dashboard |
| Reports | This assumes that the widget is a reusable component, and that if you've tested it exhaustively insolation a simpler integration test for all pages will suffice. But sometimes you don't quite have that confidence, so if you really do want to test the full Cartesian product then it might be worth saying that explicitly and solving the problem of doing so in code Scenario: The widget works everywhere
* The widget should be available on these pages
| Home |
| Dashboard |
| Reports |
* The widget should supports these features
| Logout |
| Set status |
| Admin panel |
Given an admin user
Then the user can use all widget features on every page |
Beta Was this translation helpful? Give feedback.
-
Interesting case. |
Beta Was this translation helpful? Give feedback.
-
Hello Community, 👋
I am using C# .NET with Reqnroll, but I believe my case applies to the core Gherkin.
I am working on a testing scenario where I need to execute the same
.feature
file multiple times with different parameters. Ideally, this would work like aBackground Outline
concept, akin toScenario Outline
, with anExamples
table that provides the variables. However, I understand that such a feature does not currently exist.The goal is to reduce redundancy and maintenance overhead when dealing with groups of similar scenarios. Here is the specific use case:
The variable could be used in
Background
, eg:because the exact same scenarios apply to 2 or 3 different pages. So, it would be perfect if something like this existed:
and the tests run once for each variable in the
Background
.Is there a way to create something akin to
Background Outline
?For example, can we parameterize an entire
.feature
file and run it multiple times with different parameters?Are there existing mechanisms or plugins that allow similar functionality?
If not, what workarounds would you recommend for achieving this?
I found something similar from Specflow here, but I don't think it fits my case.
I appreciate any insights, ideas, or guidance you can provide. If needed, I’m happy to contribute to or collaborate on a feature request to bring this capability. Looking forward to hearing your thoughts!
Beta Was this translation helpful? Give feedback.
All reactions