Why whitebox testing is effective?

Let me guess, by now you must have heard that whitebox testing is all about looking into the code and plucking errors from them. But its not all easy, thought would give some live example, where it could be used and how you can make use of it catch some critical errors.
Imagine you are testing a program to get the time a machine has been updated, like a windows update. Think your program is getting it in the format YYYY/MM/DD.
Sample program:
getUpdateTime{
var time = <get the time in format YYYY/MM/DD>
set(YYYY)
set(MM)
set(DD)
}
Now this would work only if the user has set his local time also in the above format. Imagine the user is in some other country and his settings are MM/DD/YYYY. Now this would surely crash, since its not matching at all.
This can be easily caught by white box testing.
Also adding you can reduce your test cases, by testing it whitebox rather than having to do by running your program on different OS of different languages.

Leave a Reply

Your email address will not be published. Required fields are marked *