I'm looking for a way in lettuce to specify code to run from my Gherkin feature file such that it has already run when I get to the @before.each_scenario
hook - this is essentially to do a dynamic set of examples for a scenario outline, so given an application which has a catalogue of things, each of which I want to test, I want to be able to do something like the following:
Feature: Automated Catalogue Test
In order to have use the system
As a user
I want to be able to use each feature in the catalogue
Background:
Given I start the system
And I have a list of features
@foreach
Scenario Outline: I use each feature in the system
Given feature <feature_num>
When I load the feature
And I use the feature in the way they are all used
Then I can clear up the feature
So I have this working for a pre-set list of examples, and I have been able to test the logic just by using a hook to extend the scenario, and it works, however this means that if one feature fails those that would be after will not run.
If the Background step were to run only once and before the @before.each_scenario
then I could set the list of outlines
that are enumerated at lettuce/core.py:722
, however as far as I am aware this is not part of the Gherkin language; I would not want to add I have a list of features
to the terrain though as there are many other tests that don't need to know about this catalogue...
I don't suppose anyone has any suggestions?