c开发者_JAVA技巧ould you give me some examples, of when would white box testing find errors where black box testing will not?
Neither is necessarily better than the other. A black box approach tends to be a user focused approach. So this is a good way to ensure the usability and correctness of an application from a user perspective. The drawback to testing from just a black box perspective is many of the code paths may remain unexercised. This is where white box testing comes into play. Using both together is frequently referred to as grey box testing and it allows you to build user focused scenarios as well as verify you are getting good code coverage as well as efficient use of your test cycles.
A couple good resources for additional information include How We Test Software at Microsoft, Testing Computer Software.
Black box: Here, the verification is based on the requirements of the design. Thus, anything external to the design and the performance of the design in terms of requirements must be verified. In terms of assertions, that would mean the interfaces and responses. They can also include assumptions if the configurations are fixed. They may also include coverage about important test cases with reference to the requirements. The implementation of the design is not considered. These assertions are typically written by a verification, and not by the designer. They can, and should be done prior to the actual design tasks.
White box: That deals with the actual implementation. Typically, a designer may add information about assumptions, and assertions about expected results particular about the design. For example, if the design uses a FIFO, it would be good to add assertions about the FIFO never reading a value when it's empty, or push data when full. If the design has an EDAC, assertions should be added that the EDAC is indeed performing its duties. These assertions are typically written by the design ever, and they are important.
See the Wikipedia entry on Software testing. I think the most important point regarding white-box vs. black-box is:
White box testing methods can also be used to evaluate the completeness of a test suite that was created with black box testing methods. This allows the software team to examine parts of a system that are rarely tested and ensures that the most important function points have been tested.
Basically, white box testing allows you to test execution paths that you might have overlooked with black-box testing simply because you wouldn't have known they existed.
精彩评论