Maintainability is the ease of understanding, modifying, correcting, or enhancing software. Readable, persistent examples of required behavior can help teams preserve that understanding as people and business needs change. section 1.3.6
Two practices support maintainability in these examples:
- Automated examples connect stakeholder requirements to delivered behavior and help guard against side effects and regressions. section 1.3.6
- Centralizing default test values in a readable DomainDefaults class makes automation code more consistent and its decisions clearer. section 14.1
Listing 14.3 Class to keep the defaults and modified step definition
*** Support/DomainDefaults.cs ***
public static class DomainDefaults
{
public const string PizzaSize = "Medium"; #A
}
*** StepDefinitions/OrderingStepDefinitions.cs ***
[Given("the customer has placed an order containing a {string} pizza")]
public void GivenTheCustomerHasPlacedAnOrderContaining(string pizzaName)
{
var order = ...
order.AddItem(pizzaName, DomainDefaults.PizzaSize); #B
...
}See a hard-coded pizza size replaced with a named default in DomainDefaults. section 14.1









