liveBook · Manning

Reference data

As explained in Unit Testing Principles, Practices, and Patterns

Reference data is database data that must be prepopulated for an application to operate and cannot be modified by that application.

Reference data is database data that must be prepopulated for an application to operate properly and cannot be modified by that application. It belongs to the database schema alongside tables, views, indexes, and stored procedures. section 10.1

User types in a CRM system

A UserType table containing Customer and Employee values is reference data when users depend on those rows through a foreign key. The application relies on the values but does not modify them. section 10.1

Manage reference data as part of database delivery:

  • Store it in source control with the rest of the database schema. section 10.1
  • Apply every change through explicit migrations rather than treating the data as disposable test data. section 10.7
  • When resetting integration tests, delete regular data but preserve reference data; let migrations control it. section 10.3

How Unit Testing Principles, Practices, and Patterns covers it

How deep it goes
Defines the distinction, demonstrates a foreign-key example, and specifies migration and test-cleanup rules.
Examples
Uses CRM user types and a test deletion script that removes regular data while preserving reference data.
What it assumes
Assumes familiarity with application databases and foreign keys while defining the reference-versus-regular-data distinction explicitly.
What you can do after
Operate/configure database delivery by placing reference-data changes in migrations and excluding reference rows from test cleanup.
How it connects
Connects reference data with database schema, foreign key constraints, migrations, regular data, and integration-test cleanup.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Unit Testing Principles, Practices, and Patterns. The section links point to the parts of the book it draws on.