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