I have a dream I would like to achive with Cucumber.
I would like to combine cucumber with selenium (<= so far so good) AND optimize the test execution with tags. In my dream I'm able to tag my szenarios with Strings which represent a database szenario. For example:
@noData
Scenario: bake a bread
@oneBread
Scenario: look at bread
@tenBreads
Scenario: give multiple breads to the poor
Some of my tests alter the data, some don't. So I thought, how about clustering all "non-altering" tests to access the given data in parallel
@viewOnly
Scenario: look at a bread
@viewOnly
Scenario: smell a bread
With this kind of clustering I aim to achive the slightest setup and working in parallel if possible.
@noData
@viewOnly
Scenario: bake a bread
when i bake a bread
then i see a bread
@oneBread
@viewOnly
Scenario: look at a bread
then i see a bread
@oneBread
@viewOnly
Scenario: smell a bread
then i see a bread
@oneBread
Scenario: slice a bread in half
when i slice my bread
then i got two parts of the bread
@oneBread
Scenario: butter a bread
when i butter my bread
then i got one bread covered in butter
With this Feature file, I'd expect that this solution would process the features in the following order:
@noData => Scenario: bake a bread
@oneBread => @viewOnly Scenario look at a bread
@oneBread => @viewOnly Scenario smell a bread
@oneBread => Scenario slice a bread in half
@oneBread => Scenario butter a bread
Once I played with JUnit runners and tried to process the created JUnit Tests on my own. Do I have to write my own JUnit runner again? Or is it possible to fullfil my requirements with Cucumber features ?
Can someone help me with that?
You could do that by running separate test for each database scenario. For that use the --tags parameter as explained here https://github.com/cucumber/cucumber/wiki/Tags#running-a-subset-of-scenarios
Another way, which I prefer, is to put similar database scenarios into feature files. For example a feature file for those how altering data. Use @Before to get the scenario's tags.
@Before
public void beforeTest(Scenario scenario){
}
hope that helps!