So then maybe what we can do is just to
pick our test inputs randomly so to do what is called
random testing. And what that means is that we pick the
inputs to test just as we pick a number by rolling
a set of dice randomly. And this will have several advantages.
First, we will pick inputs uniformly. So if we use a
uniform distribution as the basis for our random testing, we will
make no preferences. In other words, all inputs will be considered
equal, of equal value. And what that means in turn, is
that random testing eliminates designer bias. So what does designer bias
mean? Designer bias is the problem of making the same assumption,
when we read the specification and we interpret it and when we
develop test cases. Which means that the developer might develop code,
assuming a given behavior of the user. And we may write
tests, making the same assumptions. And the problem, of course, is
even worse if it's the same person that develops the code and
writes the test cases. With random testing, the problem is gone,
because we just pick randomly what our inputs will be. So
why not do in random? The problem is that when testing,
we are looking for a needle in a haystack. Actually, multiple
needles in multiple haystacks, if we want to be precise. So,
random approaches are not necessarily the best way to go about
it, because we might just be looking in all the wrong
places. So let me show you this, using a different representation
for the haystack. What I'm showing here is a grid, and
imagine this grid just expanding indefinitely outside the screen, and this grid
represents the domain for the program, so each box in the grid,
each square in the grid, it's a possible input. So what happens
with bugs is that bugs are very scarce in this grid. Maybe
there is a bug here, so that means that there is a
bug, than an input, in this point we'll reveal. And maybe there
is another bug that will be triggered by an input over here.
So imagine this spread out over this infinite grid. Its very unlikely
that just by picking randomly that we will be able to get to
these two points. Fortunately not all is lost, there is a silver lining.
So we need to look a little more in depth into this grid.