Domain Range Ratio (DRR)
From HandWiki
The Domain Range Ratio (DRR) of a logical function (or software component) is the ratio of the cardinality of its set of all possible inputs (domain) to the cardinality of its set of all possible outputs (range).[1] Most developers try to reduce the DRR of their functions to as small as possible.
Example
To understand this metric, consider the function isEven():
boolean isEven(short x) {
if (x == 0) {
throw new Exception("Give me a proper number");
}
return x % 2 == 0;
}
This function checks if a short number is even or not, with an exception at 0. The DRR of isEven() is 64k possible inputs to 2 outputs (boolean, exception). A high DRR, like this one, indicates potential information loss and a low probability of finding defects just by selecting a handful of samples.
References
- ↑ Voas, J.M. and Miller, K.W., “Semantic metrics for software testability”, The Journal of Systems and Software, 20(3), 207-216 (March 1993).
