## The Triangular Distribution in Software Testing

A very simple and useful quantitative technique in software testing is using the Triangular Distribution for estimation in situations with very limited data (as few as two data points). Here’s an example from a half-day tutorial "Quantitative Techniques for Software Management" I am presenting at the Better Software Conference and Expo (http://www.sqe.com/bettersoftwareconf/) from June 9-12, 2008 in Las Vegas, Nevada.
Suppose you are managing an internal software project and it is ready to ship. You wish to estimate how many undiscovered bugs your system will ship with. Your system has 100 main modules. You thoroughly examine just 4 of the modules (because the process is very time-consuming and costly) and discover one module has 6 bugs, two modules have 18 bugs, and one module has 24 bugs.

a.  Use the Triangular distribution to determine a point estimate of the number of bugs your system will ship with.

a = smallest value = 6
b = largest value = 24
c = most common value = 18
mean = (a+b+c)/3 = 48/3 = 16.0 bugs
b.  Compute the Triangular variance and recast your point estimate to a 70% confidence interval (z = 1.04) estimate.

variance = (a2 + b2 + c2 – ab – ac – bc) / 18
= (36 + 576 + 324 – 144 – 108 – 432) / 18
= 14
std dev = sqrt of variance = 3.7 bugs

Therefore, we estimate that the system will ship with 16.0 plus or minus 3.9 bugs. The Better Software Conference has a lot of interesting talks and tutorials related to software project management. Check it out at http://www.sqe.com/bettersoftwareconf/.