Behavioral testing techniques

One very common source for errors is improper handling of boundaries. The idea in boundary value analysis is to test boundaries on the edges, for example MIN, MIN-1, MAX, MAX+1. These values should be exercised both for input and output of methods (when applicable).

It is impossible to create all the possible input data for the methods, which may happen when the system is used in actual reality. However, the similar data passed for the method does not usually change the execution path, and thus data can be abstracted. Equivalence class partitioning is a behavioral test design method that divides all the similar input values into classes. For example, if the method accepts values between -5 and 15, there are three classes, and thus only three test cases are needed:

Special values are a good source of errors and require extra attention from the implementation. Some examples include

Experience and intuition can guide developers to predict possible sources of errors. Because programmers often make similar errors, creating test cases through error guessing can be practical and effective. This is a good practice especially when software and development teams evolve, and test suites are run continuously. Such tests can locate bugs that crawl into software during changes.

Error-guessing-related examples include: