Friday, April 15, 2011

Whitebox Testing

Hope you have already read about blackbox testing. Whitebox testing, as the name suggests :) is a test design where focus is primarily on internal details of the software. Internal structure of the application is checked to see HOW the implementation is done. The tester therefore can know if you have used the correct logic (so you dont get to hardcode or use redundancy). This is essential because it guarantees that the output is the expected result over a larger set of valid inputs as compared to in blackbox testing where it is practically impossible to test over so many inputs (imagine running the software thousand times if the input is supposed to be name of employees in the company having 1000 employees !!!).

Now you are already getting the idea, so lets move further.

Since internal details are focussed upon, the tester needs to know the programming language used. The tester chooses inputs and then checks paths through the source code to know if it is implemented correctly rather than just checking the output.

You must be wondering why blackbox testing is required if whitebox testing can cover its purpose. Does it? Really??? If your answer is yes then i suggest you to continue reading.

In whitebox testing, the internal structure of code, implementation part is focussed upon to see HOW the software works but it doesn't focus on the specification and requirement details. Whitebox testing can uncover many errors but then again unimplemented part cannot be detected. Whether any specification or requirement is missing or not is found by blackbox testing only.

While white-box testing can be applied at the unit, integration and system levels of the software testing process, it is usually done at the unit level. Synonyms for whitebox testing: Glassbox testing, openbox testing.

For a complete software testing process, both blackbox and whitebox testing is required.Advantages of whitebox testing are: helps in optimizing code, extra lines of code can be removed (hidden defects)Disadvantages of whitebox testing are: Tester needs to know the programming language used, he needs to know the internal structure too, hidden implementation cannot be detected.

Coffee BreakCharacteristics of whitebox testing:Internal StructureTester should know programming languagePaths in code are checkedImplementation logic is checkedStatements, Paths and Decisions in the code is checked