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
From the course: Cucumber Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Cucumber tags: Add a tag4m 50s
-
(Locked)
Cucumber tags: Multiple tags2m 24s
-
(Locked)
Cucumber tags: Maven test with tags1m 39s
-
(Locked)
Background: Add background2m 26s
-
(Locked)
Background: Duplicate item2m 49s
-
(Locked)
Background: Execution flow2m 53s
-
(Locked)
Cucumber hooks: Adding hooks4m 30s
-
(Locked)
Cucumber hooks: Tagged hooks1m 49s
-
(Locked)
Cucumber reports: Generate reports3m 8s
-
(Locked)
Use monochrome and dryRun parameters3m 37s
-
(Locked)
-
-
-
-