# Domain Range Ratio (DRR)

## Definition

The Domain Range Ratio (DRR) of a logical function (or software component) is the ratio between the cardinality of the set of all possible test cases (inputs) to the cardinality of the set of all possible outputs.[1]

## Discussion

To understand this metric, consider a function (hardware or software) that outputs one of two states: (‘1’) or (‘0’). Further, assume that each output state occurs 50% of the time. Because of this minimal output space size, a fair coin toss also has a 50-50 chance of providing a correct output for any given input, and that could certainly be less expensive than the cost to build and implement the function. Worse, consider the scenario where ‘1’ and ‘0’ are not evenly distributed, e.g., the specification states that for 1M unique test cases only 10 should produce a ‘1’ and the other 999,990 should produce a ‘0’.

Here, you could build this function or you could write a piece of code that simply says: for all inputs output (‘0’). This incorrect code is still 99.999 reliable, and you’ll almost certainly not discover the defect in the code with a handful of random tests sampled from the 1M. In short, testing here has a minimal probability of detecting this faulty logic because each test case has such a low probability of revealing the defective logic due to the tiny output space and its probability density function for each output. If you view the definition of a testable system to be one where test cases have a reasonable chance of detecting defects, then a high DRR suggest low observability of defects during test, and hence low testability*.
_____________________
* Testability here refers to the likelihood that defects can be discovered during testing.[2]
[3]

## References

1. ^ Voas, J.M. and Miller, K.W., “Semantic metrics for software testability”, The Journal of Systems and Software, 20(3), 207-216 (March 1993).
2. ^ Voas, J.M. and Miller, K.W., “Software testability: the new verification”, IEEE Software, 12(3), 17-28 (May 1995).
3. ^ Woodward, Martin R.; Al-Khanjari, Zuhoor A. (5 Sep 2000). "Testability, fault size and the domain-to-range ratio: An eternal triangle". ACM SIGSOFT. pp. 168–172. doi:10.1145/347324.349016. ISBN 1-58113-266-2. Retrieved 2016-05-04.