A scenario can pass alone and fail when another scenario changes the same database. Clean Start gives each scenario an empty starting state, then makes it create the records needed for the behavior it tests. The goal is repeatable results without relying on data left behind by earlier scenarios. section 18.3 section 18.1
An order scenario
Suppose a scenario checks what happens when an order is paid. Rather than assume a suitable customer and order already exist, it creates the ones it needs. Another scenario can use different data without depending on those records. Configuration records or default lookup values may also need to be inserted; reusable insertion functions reduce that setup work over time. section 18.3
Use the pattern with its costs and limits in mind:
- Reset before each scenario. Make the reset fast, seamless, and independent of particular record IDs. section 18.3
- Expect more setup when writing a scenario, in exchange for independent maintenance and fewer failures caused by changes to a shared baseline. section 18.3
- Do not treat a reset as a complete solution for parallel scenarios using one shared database: their changes can still conflict during execution. section 18.1 section 18.7
Clean Start is the simplest baseline. A seeded baseline supplies commonly needed entities instead; a snapshot baseline may suit a service whose data cannot readily be manipulated. Choose according to what the service lets scenario automation create and reset. section 18.1 section 18.7
