Feature file structure

Feature files are comprised of the following elements. Note that most elements appear in most files, but some elements may not be needed for every feature or scenario:

  • One or more optional categorization tags
  • Feature name
  • Feature description
  • Background
  • One or more scenarios

The examples in the following sections come from different feature files in the base configuration.

File-level information

Guidewire recommends limiting each feature so that it has scenarios for only a single persona.

Tags

A tag is a text string that identifies the purpose or category of a feature file. Tags have two uses:

  • A test suite is a collection of feature files that are executed at the same time. You can use tags to help define the scope of a test suite.
  • If a feature file has scenarios that are specific to a given line of business, you must use tags to identify the line of business.

A tag must start with an @, but it can be followed by any text. For example:

@personal_auto

A feature file can have any number of tags. Each tag must be separate by a space. For example:

@personal_auto @issuance

Feature name and description

The feature file starts with the feature name and a brief description. Guidewire recommends this information be formatted as:

As a <persona/system>
I want to <action>

For example:

Feature: Activity

  As an agent,
  I want to create a new activity or manage an activity assigned to me on the policy.

Background

The background is a set of steps that describe the pre-conditions for all scenarios in the feature file. Background steps are executed before each scenario in addition to each scenario's Given steps. The purpose of the background is to prevent repetition of the same requirements in every scenario, such as the relevant persona.

Every feature file can have only one background. The background is declared before the first scenario.

For example:

Background:
  Given I am a user with the "Producer" role
  And today's date is "07/01/2018"
  And an in-force Personal Auto policy