I'm looking at serenity (the following versions)
<serenity.version>1.1.26</serenity.version>
<serenity.maven.version>1.1.26</serenity.maven.version>
<serenity.cucumber.version>1.1.5</serenity.cucumber.version>
I have feature files F1, F2, F3.
I'm looking for support to run all the scenarios in F1 (only) to run in a single browser session.
The scenarios in F2 and F3 can run in a "browser per scenario" mode.
How to achieve this?
Cucumber hooks do the job for you.
Note that I use the cucumber before, not the JUnit before.Do make sure you have a reference to the
DRIVER
in your tests. The hooks wil run before and after each scenario (or example if you use scenario outline). If you want a specific setup for certain annotated features, for example:Then you can use:
Conclusion you can use cucumber hooks in combination with annotations in features for custom setup and teardown.