State and Behavioral Testing

Classifying the testing task at hand aids in identifying the best approach in writing the tests. Determining whether a test will verify state or behavior usefully steers the testing process.

Pure state verification exercises the code and examines the resulting changes in data values associated with the operation. Mathematical functions that simply transform inputs to outputs exemplify the target of state verification. In a functional model, verification simply determines that the return values correlate correctly with the input parameters. In an object-oriented model, you additionally verify that the attributes of the object have changed (or not changed!) appropriately. State verification tests typically supply inputs ...

Get Quality Code: Software Testing Principles, Practices, and Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.