In this case we focus on white box testing. So consider now this
other function, called fun. And let's assume that we want to test this function
without having a specification. So without knowing exactly what it needs to do.
But just by looking at the code. So we will try to do the
problem in this case is to try to just execute all the statements.
In the function. And notice I will talk extensively of what does it
means to do white box testing later on in the next, two classes.
So if that's our goal, if our goal is to cover all the statements,
any input will really do. So any test case
will excecute all statements in the code. And we'll a
complete, you know, white-box testing coverage for the program.
Imagine that I now give you a specification for this
function. And what the specification says is that this
function inputs an integer parameter, param, and returns half of
its value, if param is even, and its value
unchanged otherwise. That means if param is odd. So looking
at this specification, we can clearly see that the function fun
works correctly only for even integers, and it doesn't work for
odd integers. Because it computes. Half of the value of the
parameter and returns it every time, no matter what param is. So
this is a case in which white box testing could easily
miss the problem, because as we said any input will exercise
the code. It's just by chance that we could reveal one
that revealed the problem in the code. Conversely if we were to
work, in a black box manner. Typically looking at the specification, we
will select at least one odd, and one even input number to
exercise all of the specified behavior. And we will find the problem
right away. So these two examples are just very small examples, and
they're kind of, you know, stretched. But these kind of issues occur
on a much bigger scale and in much more subtle ways in
real world software. And so what this examples do is to show
you, how black box and white box tests are really complimentary techniques.
So in the next two lessions we will explore
these two types of techniques in detail. We will
see different kinds of white box and black box
testing. And we'll talk about their strengths and the mutations