White box test method and black box test method

Source: Internet
Author: User
Tags data structures xunit
Software testing methods are generally divided into two kinds: white box test and black box test. White box testing, also known as structural testing, logic-driven testing, or testing based on the program itself, focuses on the internal structure and algorithms of the program, often without concern for functional and performance indicators. Black-Box testing, also known as functional testing, data-driven testing, or specification-based testing, is in fact the end user's position to verify that the input and output information and system performance indicators conform to the specifications for functional requirements and performance requirements.

1. White Box test method and Black box test method

Black box test method, regardless of the internal structure and internal characteristics of the program, but from the user point of view, for the program interface and user interface testing, according to the actual function of the product should be implemented and the product specifications have been defined, to verify that the product should have the function of whether or not to meet the requirements of users.

Therefore, the black box test method technology is relatively low, the method is simple and effective, it can test the behavior of the system as a whole, and can be used to test data integrity from beginning to end (End-to-end). The black box test method is suitable for the function test, usability test, and also is suitable for the joint acceptance test and software validation test. Black box testing method is not suitable for unit test, integration test, and the coverage of test results is not easy to measure, the potential risk of testing is higher.

Due to the White box test method, the internal working process of the known product is very strong, it can test each line of the program, each condition or branch, test efficiency is high, and can be clearly tested coverage. If enough time is available, all statements and conditions are guaranteed to be tested and the test coverage is high. The White box test method is suitable for unit testing, integration testing, and not for system testing. White box test method preparation time is very long, if you want to cover all program statements, branch of the test, generally spend longer than the programming time.

White box test method requires a high level of technology, the corresponding test costs are greater. For an application system, the path number of the program may be astronomical, even with some test tools, white-box testing is not possible to carry out exhaustive testing, attempts to traverse all paths are often not done. Even if the exhaustive path test, can not find out where the program violates the design specifications, can not be found in the program has been implemented but not the user needs of the function, may not find some data-related errors or user action behavior defects. So the White box test method also has some limitations.

Source: http://blog.csdn.net/KerryZhu/archive/2006/05/30/763181.aspx

What is the difference between a white box and a black box test?1. Black box test

Black box testing is also known as functional testing or data-driven testing, it is a known product should have the function of testing to detect whether each function can be used, in the test, the program as a non-open black pot, regardless of the program internal structure and internal characteristics of the case, the tester in the program Interface test, It only checks whether the program function is normally used in accordance with the requirements specification, whether the program can properly receive the input number saw and produce the correct output information, and maintain the integrity of external information (such as databases or files). The black box test method mainly includes equivalence class division, boundary value analysis, cause-fruit graph, error inference, etc., mainly used for software validation testing. The "black Box" method focuses on the external structure of the program, regardless of the internal logic structure, testing the software interface and software functions. The "black Box" method is an exhaustive input test, in which all possible inputs are used as test cases in order to detect all errors in the program in this way. In fact, there are an infinite number of test cases where people are not only testing all legitimate inputs, but also testing those that are illegal but possible.


2. White Box test

White box testing is also known as structural testing or logic-driven testing, it is aware of the internal work process, can be tested to determine whether the internal action of the product according to the specifications of the normal, according to the procedures within the structure of the test procedures, inspection procedures in each path is able to work according to predetermined requirements, regardless of its function, The main methods of white box testing are logic-driven, base-path test, etc., which are mainly used for software verification.

The White box method thoroughly understands the internal logic structure of the program and tests all logical paths. The "white Box" method is a poor lift path test. When using this scenario, the tester must examine the internal structure of the program, starting with the logic of the checker and drawing the test data. The number of independent paths through the program is astronomical. But even if each path is tested, there may still be errors. First, the exhaustive path test must not be able to find out that the program violates the design specification, that is, the program itself is a wrong program. Second, the exhaustive path test cannot detect errors in the program due to missing paths. Third, the exhaustive path test may not find some data-related errors.

Software personnel use white box test method, the main want to do the following check the program module:
– Test all independent execution paths of the program module at least once;
– For all logic judgments, the two cases of "true" and "false" are tested at least once;
– The loop body is executed within the boundary and operating bounds of the loop;
– Test the validity of internal data structures, etc.
The specific included logic overrides are: – Statement overlay – Decision Overlay – Conditional override – Decision – Conditional override – Conditional combination override – Path overlay.

A white Box test technology (testing): Drill down to code-level testing, using this technique to find the earliest problems and the best results. The main characteristic of this technique is that the test object enters the code, according to the developer's familiarity with the code and the program, the necessary parts are in the software coding stage, and the software test that the developer makes according to their understanding and contact with the code is called the White box test. This phase of testing is dominated by software developers, tested on the JAVA platform using the Xunit series tools, and the Xunit test tool is a class-level test tool that tests each class and the method of that class.

B black Box test technology (black box testing): The contents of the Dark box test mainly have the following aspects, but mainly the functional part. Mainly covers all functions, can be combined with compatibility, performance testing and other aspects, according to software requirements, design documents, simulation of customer scenarios with the actual system testing, this test technology is the most used test technology covers all aspects of testing, you can consider the following aspects

C Correctness (correctness): calculation results, naming and so on.

D Availability (Usability): Whether you can meet the requirements of the software description.

E Boundary condition (boundary Condition): The boundary value of the input part is to use the Equivalence class division in the general book, try the maximum minimum and illegal data and so on.

F Performance (performance): The time required for the system to complete a task during normal use, and the response time for multiple people to use at the same time is within acceptable range. The implementation of the Java EE Technology system in the performance of the need to take care of, the general principle is less than 3 seconds to accept, 3-5 seconds can be accepted, more than 5 seconds on the impact of ease of use. If you find a performance problem during testing, it's hard to fix it because it often means that the algorithm is bad, poorly structured, or has a problem with the design. Therefore, at the beginning of product development, it is necessary to consider the performance of the software

G pressure test (Stress): Multi-user scenarios Consider the use of stress testing tools, which are recommended for combining pressure and performance testing. If there is load balancing, also open the Monitoring tool on the server side, check the server CPU utilization, memory consumption, if necessary can simulate a large number of data input, the impact on the hard disk and so on information. Performance optimizations are required if necessary (both hardware and software are available). The stress tests here are for a few functions.

H Error Recovery (Error Recovery): Fault handling, page data validation, including sudden power outages, input of dirty data, etc.

I safety Test (Security): This field is being researched, firewalls, patches, anti-virus software and so on do not have to say, but can be considered. Destructive testing at any time to read some of the information, this design to the knowledge content can write a book, not one or two can be said clear, especially some business sites, or with money, or the company's secret related to the web is the need for this test, in foreign countries have a special do this line of people called security advisers, Can review the code, put forward security recommendations, the handling of emergency cases, etc., in the domestic did not hear where there is a special security technology testing content.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.