Skip to content
This repository was archived by the owner on Nov 16, 2018. It is now read-only.
josephwilk edited this page Aug 13, 2010 · 36 revisions

Cucumber provides a number of hooks which allow us to run blocks at various points in the Cucumber test cycle. There is no association between where the hook is defined and which scenario/step it is run for. All hooks defined are run whenever the relevant event occurs. For example all Before hooks defined throughout the required code will be run for each scenario.

Scenario hooks

Before do
  #do something before each scenario.
end
After do
  #do something after each scenario
end

Step hooks

AfterStep do
  #do something after each step
end

Clone this wiki locally