1.2. From Microscope to Telescope: Test Granularity
Test granularity refers to the fineness or coarseness of a test's focus. A fine-grained test case allows the tester to check low-level details, often internal to the sys tem; a coarse-grained test case provides the tester with information about general system behavior. Test granularity can be thought of as running along a spectrum ranging from structural (white-box) to behavioral (black-box and live) tests, as shown in Figure 1.1.
Structural (White-Box) Tests
Structural tests (also known as "white-box tests" and "glass-box tests") find bugs in low-level operations such as those that occur down at the levels of lines of cod e, database schemas, chips, subassemblies, and interfaces. These structural tests are based on how a system operates. For example, a structural test might reveal that the database that stores user preferences has space to store an SO-character username, but that the field only allows 40 characters to be entered.
Structural testing involves a detailed knowledge of the system. For software, testers develop most structural tests by looking at the cod e and the data structures themselves; hard ware structural tests compare chip specifications to readings on oscilloscopes or voltage meters. Structural tests thus fit well in the development area. For test staff—at least those separated from low-level details and without programming or engineering skills—Structural testing can be difficult.