From the course: Cucumber Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Cucumber hooks: Tagged hooks

Cucumber hooks: Tagged hooks

From the course: Cucumber Essential Training

Start my 1-month free trial

Cucumber hooks: Tagged hooks

- [Instructor] Let me go ahead and show you another concept called Tagged Hooks. So what if you wanted this Hooks class and its methods to run before a small subset of your scenarios? You could apply a tag here. So for example, I am going to put here at SmokeTest, and do the same thing here, at SmokeTest. Let me go ahead and run this test. And when I look at the output here, it seems like the Constructor called method and others are running fine. But the before and after, just ran for the add a menu item scenario. So, let me go back and show you feature file and SmokeTest tag is applicable only to the first scenario add a menu item. So this was expected behavior. So this is our restaurant system Hooks or Hooks class. So a common question that arises, is which one should I use, Background or Hooks? In most cases, Background is useful only if a non programmer stakeholder needs to see something. Keep in mind that Background is defined inside your feature file, which is seen by all…

Contents