-To give you a slightly better understanding of the differences - -2
-between black-box testing and white-box testing, I am going to provide you - -3
-a couple of simple examples that illustrate the, the strengths and - -4
-limitations of these two techniques. So, in this case, let's start - -5
-with black-box testing, so we're only working with this specification. - -6
-So, let's say that our specification says that this is a - -7
-program that inputs an integer value and prints it. And implementation, - -8
-we don't know because we're working at the black box level. - -9
-If we wanted to test this function according to its - -10
-specification, what we will probably do is to select a positive - -11
-integer, a negative integer, and the zero as test inputs - -12
-and see how the program behaves for these inputs. So let - -13
-me now show you a possible implementation for this specification. - -14
-What I'm showing here is this function that we called print - -15
-NumBytes, which takes the parameter and prints it. And one thing - -16
-that we notice right away is that, although in the specification, - -17
-numbers that are less than 1024 and numbers that - -18
-are greater or equal to 1024 are exactly equivalent from - -19
-the specification standpoint. They're however treated differently in the - -20
-code, so the developer decided that the program was just - -21
-going to print the value of the parameter if it's - -22
-less than 1024. But it was actually divided by 1024 - -23
-and printing it with a kilobyte mark after it - -24
-if you are greater than 1024. And notice that here, - -25
-there is a problem. The developer, just a number 124, instead - -26
-of 1024. So there's probably a typo in this point in the - -27
-code. So this is a case in which by simply doing black-box - -28
-testing, so by simply looking at the specific issue, we might miss - -29
-this problem. Because we have no reason to consider numbers that are - -30
-less than 1024 or greater than 1024. However if we were to - -31
-look at the code, so operating at white-box manner, we will right - -32
-away see that we need to have a test case that checks - -33
-the program when the parameter is greater than 1024. And we will find - -34
-the problem right away. So now let me show you a dual example. -- cgit 1.4.1