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

Background: Add background

From the course: Cucumber Essential Training

Start my 1-month free trial

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…

Contents