Test Patterns: State vs Behavior Verification

This site gives a good definition of State Verification and Behavior Verification as it concerns our efforts to establish unit tests for all new functionality.

State Verification
Behavior Verification

Heres the one line definition for each if you want the 50,000 foot view.

State Verification: We inspect the state of the system under test (SUT) after it has been exercised and compare it to the expected state.

State Verification

Behavior Verification: We capture the indirect outputs of the SUT as they occur and compare them to the expected behavior.

Behavior Verification

Its a subtle but important distinction in that with state verification you may run a series of method call or processes and verify the expected state of the system after all the call have been made. With behavior verification you are interested in verifying that individual method calls are made to components within the system under test including dependent components utilized by the system under test.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: