liveBook · Manning

External data persona pattern

As explained in Effective Behavior-Driven Development

A pattern that stores persona definitions outside feature files so they can be managed separately and reused.

A weekly sales report needs realistic daily transactions to test its behavior. Putting every transaction in the scenario would bury the business rule. An external data persona keeps that detailed definition in a separate file or repository, while the scenario names the data it needs. section 17.4

Listing 17.11 Scenario that uses realistic traffic data
*** Features/realistic-traffic.csv ***
Date,Pizza,Sales    #A
2026-03-09,Truffle Bliss,2540
2026-03-09,Margherita,6850
...
*** Features/Reporting.feature ***
Rule: Weekly report can be generated with daily and by pizza breakdown
  Scenario: Weekly sales report provided for a realistic traffic
    Given sales traffic from "realistic-traffic.csv"    #B
    And the restaurant owner is authenticated
    When the sales report is requested for the week beginning 2026-03-09
    Then the report should show:
      """
      * By Pizza
      ...
      """

The sales-traffic CSV holds the detailed records; the feature file stays focused on requesting and checking the weekly report. section 17.4

Use this pattern when:

  • A persona definition is too large to include without making a scenario hard to read. section 17.4
  • Several feature files need the same persona definition. section 17.6
  • Domain experts need to curate realistic inputs and expected results together. section 17.4

Keep the outcome checkable even when the inputs are hidden from the scenario. Check a result property or range, use an approved outcome to detect changes, or store expert-calculated expected values with the data. Because external personas are part of the specification, keep them alongside—and versioned with—the feature files. section 17.4 section 17.6

How Effective Behavior-Driven Development covers it

How deep it goes
Explains when to externalize data and how to validate outcomes, then illustrates CSV loading through a C# step definition.
Examples
Uses a restaurant’s sales-traffic CSV, a weekly reporting scenario, and a C# step definition that loads the records.
What you can do after
Build it from scratch by storing persona data externally, loading it in scenarios, and making expected outcomes checkable.
How it connects
Connects external personas to in-place personas, feature files, templated personas, and approval testing.

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.