Search code examples
cucumbercypress

cypress cucumber bypass Background


I have a Background hook defined in a Feature file, since i need to run a set of steps (around 4) before each scenario. I have around 25 Scenarios out of which 4 Scenarios doesn't require the last 2 steps in the Background. Is there a way to bypass the 2 steps or otherwise the Background itself?


Solution

  • Just stumbled upon this. Background means that and exactly that has to be executed before every scenario. Stands for beforeEach practially. Meaning if you have 4 scenarios which require a different background we're speaking of a different feature.

    Or you include the extra 2 steps in every other scenario.

    Albeit I get your point you should keep it this strict and simple