Cucumber Scenario Hooks can be used to better manage our tests. Hooks are essentially methods which we can use acting as listeners in our code which can be executed without directly being called. Hooks allow us to run specific code both before and after tests as well as other variations. We can take advantage of such hooks to help us easily run code before and after tests such as running common methods before each test and closing the web driver after each test.
Cucumber Scenario Hooks Video Tutorial
Follow the video tutorial above to learn how to write hooks into your tests.