软件测试基础-黑盒和白盒

黑盒和白盒只是一个相对的概念,严格意义上说,并并没有绝对的黑盒和白盒,而且现在也有了灰盒的概念。

看看wiki上对于黑盒白盒的定义吧。

Black box testing

Black box testing takes an external perspective of the test object to derive test cases. These tests can be functional or non-functional, though usually functional. The test designer selects valid and invalid input and determines the correct output. There is no knowledge of the test object’s internal structure.

This method of test design is applicable to all levels of software testing: unit, integration, functional testing, system and acceptance. The higher the level, and hence the bigger and more complex the box, the more one is forced to use black box testing to simplify. While this method can uncover unimplemented parts of the specification, one cannot be sure that all existent paths are tested.

Test design techniques

Typical black box test design techniques include:

* Equivalence partitioning
* Boundary value analysis
* Decision table testing
* Pairwise testing
* State transition tables
* Use case testing
* Cross-functional testing

[edit] Hardware

Functional testing devices like power supplies, amplifiers, and many other simple function electrical devices is common in the electronics industry. Automated functional testing of specified characteristics is used for production testing, and part of design validation.

White box testing

White box testing (a.k.a. clear box testing, glass box testing or structural testing) uses an internal perspective of the system to design test cases based on internal structure. It requires programming skills to identify all paths through the software. The tester chooses test case inputs to exercise paths through the code and determines the appropriate outputs. In electrical hardware testing, every node in a circuit may be probed and measured; an example is in-circuit testing (ICT).

Since the tests are based on the actual implementation, if the implementation changes, the tests probably will need to change, too. For example ICT needs updates if component values change, and needs modified/new fixture if the circuit changes. This adds financial resistance to the change process, thus buggy products may stay buggy. Automated optical inspection (AOI) offers similar component level correctness checking without the cost of ICT fixtures, however changes still require test updates.
Software Testing Portal

While white box testing is applicable at the unit, integration and system levels of the software testing process, it is typically applied to the unit. While it normally tests paths within a unit, it can also test paths between units during integration, and between subsystems during a system level test. Though this method of test design can uncover an overwhelming number of test cases, it might not detect unimplemented parts of the specification or missing requirements, but one can be sure that all paths through the test object are executed.

Typical white box test design techniques include:

* Control flow testing

* Data flow testing

For more information on Control flow testing and Data flow testing click on this link to download pdf.

This entry was posted in 软件测试 and tagged . Bookmark the permalink.

One Response to 软件测试基础-黑盒和白盒

  1. 进化 says:

    一个看到代码,一个看不到
    就分清楚了
    当然啦,使用的测试方法也不一样:-)

Leave a Reply

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