Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a cucumber hook to run before and after each feature

Is there a way to run specific code block before and after each cucumber feature with certain tag?

Since setup process is very expensive I don't want to run it before each scenario.

like image 723
LukasMac Avatar asked Apr 16 '14 15:04

LukasMac


1 Answers

The hooks for cucumber are described in this wiki page which show the before and after hooks you can have.

Taken from that page is this example:

The following example will cause scenarios tagged with @fast to fail if the execution takes longer than 0.5 seconds:

Around('@fast') do |scenario, block|
  Timeout.timeout(0.5) do
    block.call
  end
end
like image 187
Mike H-R Avatar answered Oct 03 '22 13:10

Mike H-R