Most people think unit testing is a kind of white box testing. So when they write test program for the unit under test, they say "We have done white box testing" It's a big big BIG mistake!!!
Let's see the definition of these terminologies first

1. White box testing: is a test case design moethod that uses the control structure of the procedural design to derive test cases
2. Black box testing: focuses on the functional requirements of the software.
That is black box testing enable the RD to derive sets of input conditions that will fully exercise all functional requirements for a program
3. Unit testing: focuses verification effort on the smallest unit of software design - the module, class, or function.

From the definition, if you want to use white box testing to test your program, you must consider the control structure of the program under test. For example: branch, condition, loop, path, and so on. It means you have to analyze the path structure first. That's why you have heard about statement coverage, branch coverage or condition coverage because they want to use these criteria to measure your testing effort of white box testing. Therfore, when you do unit testing, you can use white box testing or black box testing. Depend on how many resources you have. Due to the size of unit is small, it's a good chance to use white box testing. If the number of unit is too large, people might use black box testing to save time.
In Taiwan's software industry, most engineers just input some values to their program and check whether they are correct or not. Therefore it's just a kind of example appling black box testing to do unit testing.
創作者 kojenchieh 的頭像

David Ko的學習之旅

kojenchieh 發表在 痞客邦 留言(0) 人氣()