liveBook · Manning

Persona

As explained in Effective Behavior-Driven Development

A representative user profile or named representation of a situation used to discuss expected behavior.

A persona is a meaningful name for a user or a set of data representing a particular situation. In BDD, it can describe a specific configuration, seed-data set, or entity structure—not just a UX user profile. section 17.1

A persona definition provides the data needed to create an instance for automation and lets stakeholders understand the intended behavior while reading a feature file. Record meaningful names and their relevance in the product glossary. section 17.0 section 17.1

Personas can name:

  • Specific users, such as an admin user or website guest. section 17.1
  • A particular data situation, such as a customer with a massive order history. section 17.1
Table 17.1 Comparison of test data definition strategies
Usage of test data
Example
Recommended strategy
Incidental data that is necessary to automate the application, but not relevant to the scenario and the specified business rule.
When an order is placed
It is unimportant what is being ordered.
Manage data in the automation code, for example using the Domain Defaults pattern.
Data that is relevant (“essential”) for understanding the scenario
When an order for 5 "Large" pizzas is placed
It is essential to say how many large pizzas are being ordered.
Include the data in the scenario as step text, data table or docstring. This can be achieved by using step definition parameters (chapter 12) and the patterns Terminology Promotion, Data Table Accessor (chapter 14), and Approved Outcome (chapter 16).
A small persona definition, that is relevant in a single feature file.
Given the customer has the following orders
| id | status    |
| A  | Completed |
| B  | Placed    |
| C  | Placed    |
Include the data in the feature file. If it is needed by multiple scenarios, specify it as a Background.
The In-place Persona pattern in this chapter discusses this approach in detail.
Large persona definitions, where the details are not required to understand the scenario. Typically, created and validated by domain experts.
The persona definitions may contain expected results as well as input data.
Given sales traffic from "sales.csv"
Store the data in external sources, like Excel, CSV, XML or JSON files. Name the external sources in a way that describes their purpose. The scenario can explicitly load the data by name and process it.
The External Persona pattern in this chapter discusses this approach in detail.
Large persona definitions that contain mostly incidental data, but that include a few data points that are essential to understanding the scenario. The complete definition is created and validated by domain experts.
Given sales traffic from "sales.csv" with
  | exclude section |
  | truffle sales   |
 
Store the definitions in external sources as a template. The scenario should explicitly specify both the template to be used and any essential data variations. The automation generates the final definition from the template and the specified variations.
The Templated Persona pattern in this chapter discusses this approach in detail.
Persona definitions that vary for different executions of the same scenarios, for example verifying the application behavior described by the scenarios for different market regions.
Given the net price of the Margherita pizza is 8[CUR]
Use placeholders in scenarios to refer to the varying data (e.g., [CUR]) and substitute concrete values for the placeholders, based on the persona definition provided for each execution (e.g., use USD if the execution verifies the scenarios using the “US market” persona).
The Parameterized Scenario pattern in chapter 20 discusses this approach in detail.

Compare test-data strategies by whether the data is incidental to automation, essential to the scenario, or suited to a persona definition. section 17.1

How Effective Behavior-Driven Development covers it

How deep it goes
Defines personas and persona definitions, then previews ways to place and manage them.
Examples
Uses admin users, website guests, and customers with massive order histories as examples.
What you can do after
Understand how named users or data sets make scenario behavior and its supporting data clearer.
How it connects
Connects personas to BDD, feature files, data structures, seed data, and product glossaries.

Also explained in

Compare how 11 books explain persona →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Behavior-Driven Development. The section links point to the parts of the book it draws on.