Chapter 3. Enabling Fixtures

In this chapter, we will cover the following topics:

  • Tagging
  • ANDing and ORing Tags
  • Adding Hooks to Cucumber code
  • Tagging the Hooks
  • ANDing and ORing the Tagged Hooks

Introduction

In this chapter, we will discuss how to get control of what Features to run, and when to run them; for example, we may want to run only one set of Feature files like Sanity, or we may want to take a screenshot after each Scenario. This type of control is called fixtures. Cucumber allows us to enable fixtures via the concepts of Tags and Hooks. With knowledge of the concepts covered in this chapter, you will be able to write very effective and efficient fixtures.

In this chapter, we will start with basic concepts of Tags and Hooks followed by ANDing ...

Get Cucumber Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.