State Based Testing



Definition

State based testing is a black-box unit testing technique for identifying test cases that identify defects involving the implementation of the state models of classes with logical state.

Discussion

The behavior of objects can be a function of their logical state. The same test stimuli (e.g., message with parameters or exception with attributes) can produce different test results depending on the state of the object under test and the states of its collaborators, thereby increasing the difficulty of regression testing. For example, pushing an item onto a bounded stack behaves differently depending on whether or not the stack is full.

Merely testing every state or testing every transition (i.e., operation) is inadequate; one must test every operation in every state.

State based testing is very popular in the object community and has long been used in the hardware world. It also has a strong theoretical foundation.

Objectives

The typical objectives of state based testing are to:

Preconditions

State based testing can typically begin when the following preconditions hold:

Completion Criteria

State based testing is typically complete if the following postconditions hold:

Steps

During state based testing, the unit testers typically perform the following steps:

Work Products

State based testing typically results in the following work products:

Limitations

State based testing is subject to the following limitations:

Guidelines