liveBook · Manning

Exclusive data partition

As explained in Effective Behavior-Driven Development

A partitioning strategy that prevents changes made by one scenario from being visible to other running scenarios.

When scenarios share a database, one scenario’s changes can interfere with another’s. Exclusive data partitions keep those changes separate by assigning each scenario data that others cannot see, often through uniquely named entities. section 18.1

Consider this approach when:

  • The service has natural ways to separate its data, and scenarios can use their own partition. section 18.1
  • The domain has hidden dependencies that could cross partitions; finding safe boundaries requires detailed analysis and planning. section 18.1
  • A shared resource is freely used by developers, testers, or build agents, making other isolation strategies unavailable. section 18.1

Customer orders and restaurant workflows

For scenarios about one customer’s orders, create a new customer for each scenario; customers cannot see one another’s orders. That partition does not isolate restaurant scenarios handling menus or kitchen workflows, which may also conflict with customer scenarios. section 18.1

Figure 18.1 Conflicting modifications when running tests in parallel using a shared database

See how parallel changes to a shared database can conflict—the problem exclusive partitions aim to prevent. section 18.1

How Effective Behavior-Driven Development covers it

How deep it goes
Defines partitioning, gives UUID-based naming and a domain example, and cautions that hidden dependencies demand analysis.
Examples
Uses uniquely named customers for order scenarios and contrasts them with restaurant menu and kitchen workflows.
What it assumes
Assumes natural domain partitions and requires analysis of dependencies between scenarios.
What you can do after
Apply the strategy by assigning scenarios uniquely named entities when the domain supports safe data partitions.
How it connects
Connects isolation with serial execution and resource pooling, and repeatability with resetting service state.

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.