Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Explain the role of Hooks in Cucumber.
Answer: Hooks are blocks of code that run before or after specific events in the Cucumber execution cycle, such as before and after scenarios, features, or steps.

Example:

Before(() => {
  // code to run before each scenario
});
After(() => {
  // code to run after each scenario
});
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook