Types of software testing: Structural and behavioral testing
In this article on software testing we will focus our attention on both the structure of the application and its behavior; in this regard there are two approaches of considerable interest such as structural and behavioral testing; the first is connected to the White-Box technique, the second to the Black-Box. Structural testing can be formally defined as: “A test activity that can confirm that the current structure of the application matches what was designed”
The behavioral test, instead, is usually indicated as: “A test activity that can confirm that the behavior of the application corresponds to what was designed.”
The relationship between the two types of tests is therefore very subtle: one focuses its attention on the structure, the other on behavior; what they have in common is that they both verify that the object of the test corresponds to the design specifications. Every diversity is a clear sign of an anomaly, but it is not certain that this represents an error; in fact it may be that subsequent modifications to the source code, necessary for the resolution of the bugs, have led to some modification of the program structure: a rare situation, extreme and in any case avoidable, since it involves a modification also in the test-houses and a careful examination in which case a regressive test is taking place.
Behavior and structure are two objectives in contrast? Distinguishing the behavior of the program from its structure is an important step in the testing activity. Indeed:
- The behavior fixes its attention on the activities that the system carries out to satisfy our needs (Black-Box technique)
- Instead, the structure examines the internal composition of the system and its organization (White-Box technique)
Our goal is to produce a structure that has desirable behavior. The two aspects, behavior and structure are strongly linked to each other but not in conflict. The test plan will be different in the two cases: a structural test will require to carry out a series of tests that validate the structure of the program (for example, in the case of web applications, it will be necessary to verify the structure of the document, the composition of the pages, the reachability links etc.); a behavioral test is instead placed in a position closer to the user, therefore the test-cases will be simpler (for example, it will be sufficient to test the functionalities to which the user usually refers, without analyzing the internal structure or the modularity of the system), closer to the way users think and behave. For this reason, the analysis can be linked only to the external and elementary aspects of the application, thus obtaining simple but also inaccurate and often incomplete tests.