An Outside-In Approach
Verify the expected behavior of unit and component tests by comparing them to the indirect outputs of the System Under Test (SUT) as they occur. This is necessary when the expected results are transient and cannot be verified through State Verification. This requires us to intercept the behavior at an observation point between the SUT and a dependent component. Procedural Behavior Verification can be used to capture indirect outputs of the SUT using Spy Objects. Otherwise, we can load the Expected Behavior Specification into Mock Objects to verify the method calls.
Behavior Verification works well when taking an outside-in approach to software development — starting with the client code, then building out the dependent components underneath. This is a common approach in Test-Driven Development and is referred to as the London School, which takes an outside-in, behavior-based approach, by starting from the outside of the application (typically from the APIs or controllers) and works in towards the lower layers, including domain models and down to the persistence layer.