Execution flow with @Before , Background, Scenario, @After is not as expected. Please help | Selenium Forum
R
Raja Ravi Teja N Posted on 09/08/2019

I am facing some issue, when i am using hooks and background . With multiple features files and Background in them, @Before and @After are working differently. Execution happens in this order @Before, Scenario,Background,@After @Before, Scenario,Background,@After. Please suggest what should i do

 

You can find the code in below link

https://stackoverflow.com/questions/57423151/in-feature-file-with-background-before-and-after-hooks-before-is-executed

https://github.com/RajaRaviTeja/DummyCucumberProjectForHooksFlow.git


A
Ashish Thakur Replied on 09/08/2019

This is how it executes actually. @Before is executed before the scenario and then @After would be executed.


R
Raja Ravi Teja N Replied on 10/08/2019

But i have Background too. So, the order should be 

@Before

Background:

Scenario:

@After

but the order is 

@Before

Background:

@After

@Before

Scenario:

Background

@After 

@Before

Scenario:

Background

@After 

 

This is a wrong order right.