Behavioral contract
Define expected behavior before anything is probed.
Write it before the run
Agree concrete expected behavior before anything is probed. A narrow contract is easier to check and harder to misread.
Example: new lead
- Each lead gets exactly one email.
- The Calendar step waits until the email send is confirmed successful.
- A duplicate delivery of the same lead must not create a second email.
- If the provider accepted the request but the response was lost, the outcome stays unknown until confirmed. Don't resend blindly.
What each contract needs
- The target to invoke, its input and the starting state.
- The expected effect, how it is identified and how many times it should happen.
- The condition that counts as a failure.
- The observable evidence that shows expected versus actual.
Coverage
Measurable coverage comes from the supported failure controls you select and the instrumentation you can observe. Test scenarios are not generated automatically for every possible failure.
See the example catalog for contracts you can adapt.