design predicates
Design predicates are a method invented by Thomas McCabe, to quantify the complexity of the integration of two units of software.[src] Each of the four types of design predicates have an associated integration complexity rating.[src] For pieces of code that apply more than one design predicate, integration complexity ratings can be combined.[src] The sum of the integration complexity for a unit of code, plus one, is the maximum number of test cases necessary to exercise the integration fully.[src] Though a test engineer can typically reduce this by covering as many previously uncovered design predicates as possible with each new test.[src] Also, some combinations of design predicates might be logically impossible.[src]
Design predicates are a method invented by Thomas McCabe, to quantify the complexity of the integration of two units of software.[src] Each of the four types of design predicates have an associated integration complexity rating.[src] For pieces of code that apply more than one design predicate, integration complexity ratings can be combined.[src] The sum of the integration complexity for a unit of code, plus one, is the maximum number of test cases necessary to exercise the integration fully.[src] Though a test engineer can typically reduce this by covering as many previously uncovered design predicates as possible with each new test.[src] Also, some combinations of design predicates might be logically impossible.[src] ==Types of calls== ===Unconditional call=== Unit A always calls unit B.[src] This has an integration complexity of 0.[src] For example: unitA::functionA() { unitB->functionB(); } ===Conditional call=== Unit A may or may not call unit B.[src] This integration has a complexity of 1, and needs two tests: one that calls B, and one that doesn't.[src] unitA::functionA() { if (condition) unitB->functionB(); } ===Mutually exclusive conditional call=== This is like a programming language's switch statement.[src] Unit A calls exactly one of several possible units.[src] Integration complexity is n − 1, where n is the number of possible units to call.[src] unitA::functionA() { switch (condition) { case 1: unitB->functionB(); break; case 2: unitC->functionC(); break; ...[src] default: unitN->functionN(); break; } } ===Iterative call=== In an iterative call, unit A calls unit B at least once, but maybe more.[src] This integration has a complexity of 1.[src] It also requires two tests: one that calls unit B once, and one test that calls it more than once.[src] unitA::functionA() { do { unitB->functionB(); } while (condition); } ==Combining calls== Any particular integration can combine several types of calls.[src] For example, unit A may or may not call unit B; and if it does, it can call it one or more times.[src] This integration combines a conditional call, with its integration complexity of 1, and an iterative call, with its integration complexity of 1.[src] The combined integration complexity totals 2.[src] unitA::functionA() { if (someNumber > 0) { for (i = 0; i functionB(); } } } ==Number of tests== Since the number of necessary tests is the total integration complexity plus one, this integration would require 3 tests.[src] In one, where someNumber isn't greater than 0, unit B isn't called.[src] In another, where someNumber is 1, unit B is called once.[src] And in the final, someNumber is greater than 1, unit B is called more than once.[src] ==See also== Cyclomatic complexity Integration testing White-box testing ==References==[src]
32 sentences · 32 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"design predicates." encyclopegia.org, 2026, https://encyclopegia.org/wiki/design-predicates. Accessed 26 November 2026.
Chicago
"design predicates." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/design-predicates.
APA
encyclopegia.org. (2026). design predicates. Retrieved November 26, 2026, from https://encyclopegia.org/wiki/design-predicates
Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON