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.
Background: Add background
- [Instructor] What is Cucumber Background? Essentially, Background is something you add to a feature file, and it's syntactically very similar to a Scenario. The Background steps run before each Scenario in a feature file. Another important aspect of Background is that it is visible to all stakeholders, because it's part of your Gherkin feature file. I have removed all tag-based filtering from my test runner. This is my feature file with the three Scenarios from before. What I am going to do is add a Background to this feature file. Background is syntactically so similar, I could just copy the Scenario and paste it here. Let's change Scenario to Background, and we have our first Background defined. As you can see, this Background has three steps. Each of these Scenarios also have three steps. So, if this Background were to run before each Scenario, we would have the three steps from the Background, and three steps from each Scenario, run three times. That means a total of six steps…
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)
-
-
-
-