liveBook · Manning

Domain-specific data

As explained in Effective Behavior-Driven Development

Domain-specific data is information represented using terminology and value forms meaningful within a particular business domain.

Domain-specific data uses values meaningful in a business domain, even when automation represents them differently. In pizza ordering, a scenario can say “Large” while a step definition receives a PizzaSize enum; built-in conversion can bridge the two. section 14.4

Listing 14.13 Scenario and step definition using built-in enumeration conversion
*** Features/Ordering.feature ***
Rule: More than 4 large pizzas cannot be delivered as a single order
  Scenario: Five large pizzas are ordered
    ...
    When the customer places an order for 5 pizzas of size "Large"

*** StepDefinitions/OrderingStepDefinitions.cs ***
[When("the customer places an order for {int} pizza(s) of size {string}")]
public void WhenTheCustomerPlacesAnOrderFor(int count, PizzaSize pizzaSize)
{
  var order = new OrderObjectMother()
    .WithItems(count, size: pizzaSize)
    .Build();
  ...
}

See a scenario that uses the quoted value “Large” and a step definition that receives PizzaSize. section 14.4

Domain measurements and enum values

A scenario can express a large pizza as 14 inches; a manual mapping converts “14\"” to PizzaSize.Large. Alternatively, use the enum value “Large” directly. section 14.4

How Effective Behavior-Driven Development covers it

How deep it goes
Shows built-in and explicit enum conversion, then contrasts them with manual mappings and custom parameter transformations.
Examples
Uses pizza sizes as quoted labels, enum values, and inch measurements mapped to Small, Medium, or Large.
What you can do after
Apply via Reqnroll built-in enum conversion or explicit parameter types to pass scenario values into typed step definitions.
How it connects
Connects Cucumber expressions, enums, step definitions, and parameter conversion.

Also explained in

Compare how 2 books explain domain-specific data →

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.