Black Box Vis-a-vis White Box Testing

Black Box Vis-a-vis White Box Testing

Like most of the other developing streams of wisdom, testing also can boast of a long list of terminologies and a good hell of them makes no sense to out side world. There is no good way to really dissect various kinds of testing using a particular method because none of them is complete . One way which most of the practioners have sort of agreed upon is to divide them in two colors so as to put everything in Black and White and these are

– White Box Testing
– Black Box Testing

and as if there was still a room for any more insanity, folks have also introduced ‘Greybox testing’ and I am really waiting for the time when some smart Alec will actually have various color shades of testing. Anyway..

This is my attempt to share the definitions and meanings of these two broad category of testing.

What is Black Box Testing
You taste the final product without worrying about the ingredients, their mix, their attributes or their long term side effects of being present together. Its like having a french or a romanian cuisine where you dont care (since you dont know) on how they were done.

In terms of testing, Black box testing is the method of testing a s/w or a service like a user. You still cover much more then what a typical user will do but virtually all that stuff which you do can be done by any user in the exact same way as you are doing.

Example – You are testing a calculator so you test addition, multiplication bla bla just like any other calculator user.

What is White Box Testing
You test the small snippets of code and their flow to some extent and not the final product. Since you test at a much granular level, you sort of are not doing the stuff which any average user of that service will be doing.

Example – You are testing a calculator so your test of multiplication will be like
– clear buffers
– set values
– call function by passing the right data structures
– return the correct value
– Display/’View’

Each of these stuff will get used millions of times as part of some user scenario but you dont test a scenario, rather you assume that when each of these are used they will work.

Which one is better
Assurance – Well, a mathematical answer would be to do it ‘White Box’ way. But if you ask any practitioner, he would rather rely on Black Box technique. Why, well if computers and more so , software still act funny at times for reasons (read bugs) that we dont want to invest in. Remember all those crashes which William Henry has to face everytime he goes up to podium to demo something new. Black box is much more assuring, its like actually exercising the final product. Even though its much more work intensive and you never achieve 100 % code coverage, its much more desirable.

Skills – The other big reason which I could think behind the popularity and existence of Blackbox testing could be with to do with the availability of skills. Any smart kid can do a decent blackbox testing in couple of years whereas for white box you need more specialized training.

And finally comes the icing on the cake. Even though there is a scarcity of rightly skilled people or that feel of assurance, can the real big beasts like MS, GOOG or Adobe not hire these people and do lot of white box testing. Well, the answer is that they still rely on black box and probably the reason is

Beyond 0 and 1 – Its been generally found that the folks who have white box skills, programming and systems knowledge, are usually not too great at looking at aspects which are beyond the reach of code but are very valuable and important for a software product.

Example – If you are testing a calculator, you would be looking at things like the placement of various elements like screen/power/keys, relative sizes of certain keys, grip, color, material of the equipment, durability, size, portability, labels, battery lid and so on. I will write a blog on ‘How to test a Radio’ some time later so come back to read that.

Even though this piece of writing is going towards Why-to-love-blackbox testing, my intention is to clarify the meaning and the importance of each one of them..

More later…..

One Reply to “Black Box Vis-a-vis White Box Testing”

  1. Nice write-up Nandan.

    I think some smart Alec has already come up with another term, Glass Box testing. Somehow, definition varies from person to person.


Leave a Reply

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