CucumberJVM: 09 - Cucumber Hooks: @before & @after

 

 


@Before

public void setup(){}

 


@After

public void teardown(){}

 


Global

@Before()

 

@After()


Tagged Scenarios

@First

Scenario: first scenario

@Second

Scenario: second scenario

@Third

Scenario: third scenario

 


For @First ONLY ( NOT GLOBAL )

@Before("@First")

@After("@First")

 


Tagged Hooks

@Before() //Global

@Before("@First") //Specific

@After("@First") //Specific

@After() //Global


Ordered Hooks

@Before(order=0) //Global

@After(order=0) //Global

@Before(order=1) //Global

@After(order=1) //Global