What is black box testing, white box testing, gray box testing?

1. White box testing

White box testing, also known as structural testing, is mainly used in the unit testing phase to detect errors in the software coding process. Programmers' programming experience, mastery of programming software, working status and other factors will affect the quality of programming and lead to code errors.
The method of white box testing:
intensity from low to high:

  1. Statement coverage: All "statements" must be covered again. It is to design several test cases and run the program under test so that each execution statement is executed at least once.
  2. Decision coverage: including statement coverage, each judgment T and F once. Make the designed test case guarantee that each value branch of each judgment in the program is experienced at least once.
  3. Conditional coverage: Including statement coverage, each condition T and F refers to selecting enough test cases so that when these test cases are run, all possible results of each condition in the judgment appear at least once, but not all branches may be covered.
  4. Judgment condition coverage: including judgment coverage and condition coverage. To put it bluntly, the test cases we design can make all possible values ​​of each condition in the judgment executed at least once (condition coverage), and at the same time, all the results of each judgment itself must be executed at least once (decision coverage). It is not difficult to find that the judgment condition coverage satisfies the judgment coverage and the condition coverage at the same time, making up for the respective deficiencies of the two, but the judgment condition coverage does not consider the combination of conditions.
  5. Condition Combination Coverage: Every combination of every condition. In the white-box testing method, enough test cases are selected so that all combinations of the judgment results of each condition in all judgments appear at least once, and meeting this coverage standard becomes conditional combination coverage. It means that the test cases we design should make every possible combination of the conditions in each decision appear at least once. Obviously, the test cases that satisfy the condition combination coverage must satisfy the decision coverage, condition coverage and decision condition coverage.
  6. Path coverage: All paths are executed at least once.
    Statement coverage is the weakest coverage among all test methods.
    Decision coverage and condition coverage are stronger than statement coverage. A test case that satisfies decision coverage must satisfy statement coverage, decision coverage, and condition coverage.
    Path coverage is a relatively strong Coverage, but does not necessarily consider the combination of judgment condition results, and cannot replace condition coverage and condition combination coverage. The combination of judgment condition results must be considered, and it cannot replace condition coverage and condition combination coverage.

2. Black box testing

Black box testing, also known as functional testing, mainly detects whether each function of the software can be used normally. During the test, the program is regarded as a black box that cannot be opened, and the internal structure and characteristics of the program are not considered. The program interface is used to test whether the program function can be opened and used normally according to the design requirements and the specifications of the manual.
The method of black box testing:

  1. Equivalence class partition method
    Equivalence class partition method is a typical and important black-box testing method, which divides all possible input data of the program into several equivalence classes. Then select representative data from each part as test cases. Test cases are composed of representative data of valid equivalence classes and invalid equivalence classes, thus ensuring the completeness and representativeness of test cases. There are two main steps in designing test cases using this method: a) determine equivalence classes; b generate test cases.
  2. Boundary value analysis
    Boundary value analysis is a black box testing method for testing the boundary value of program input or output. The actual test work proves that the test cases that consider the boundary conditions have a higher test rate of return than those that do not consider the boundary conditions. The boundary conditions mentioned here refer to those states in the input and input equivalence classes that are just at the boundary, or exceed the boundary, or are below the boundary.
  3. Cause-and-effect diagram method
    The causality diagram method is also a commonly used black-box testing method, which is a simplified logic diagram. The causal diagram can intuitively show the causal relationship between input conditions and output actions, and can help testers focus on the input combinations related to program functions. The cause-and-effect graph method is a test method suitable for describing the combination of various input conditions. According to the combination of input conditions, the constraint relationship, and the causal relationship of output conditions, it analyzes various combinations of input conditions, thereby designing test cases. It is suitable for checking various combinations of program input conditions
  4. The decision table method is a tool for analyzing and expressing the situation of performing different operations under multiple logic conditions.
    a condition pile: lists all the conditions of the problem
    b action pile: lists the possible operations that the problem specifies may be taken
    c condition item: lists the values ​​for the conditions listed in it, and the true and false values ​​in all possible cases
    d action Item: List the actions that should be taken under the various values ​​of the condition item
  5. Error analysis method
    Error guessing method is based on past experience and intuition, referring to past errors in software systems, guessing possible defects and errors in the current program under test, and designing test cases in a targeted manner.

3. Advantages and disadvantages of black box testing and white box testing

Advantages and disadvantages of black box testing and white box testing

4. Gray box testing

Gray box testing is a test between white box testing and black box testing. Gray box testing is mostly used in the integration testing phase, not only focusing on the correctness of output and input, but also paying attention to the internal situation of the program. Gray box testing is not as detailed and complete as white box testing, but it pays more attention to the internal logic of the program than black box testing, and often judges the internal operating status through some representative phenomena, events, and signs.
Definition : Gray box testing consists of methods and tools that draw on the internal knowledge of the application and the environment it interacts with and can be used in black box testing to enhance the efficiency of testing, error discovery, and error analysis.
Academic meaning : Gray Box is a device in which the working process on a program or system is partially recognized.
Gray box testing, also known as gray box analysis, is a software debugging method based on limited knowledge of the internal details of the program. Testers may know how system components interact with each other, but lack detailed knowledge of internal program functions and operations. For internal processes, gray box testing treats the program as a black box that must be analyzed from the outside.
Gray box testing is often used with web service applications because the Internet can provide a relatively stable interface despite the complexity of the application and its constant evolution. Since the tester is not required to touch the source code, gray box testing is non-aggressive and bias-free. There is a clear distinction between developers and testers, and the risk of personnel conflicts is minimized. However, gray box testing is more difficult to find and solve potential problems than white box testing, especially in a single application, the internal details of white box testing can be fully grasped. Gray box testing combines elements of white box testing and black box testing. It takes into account the client, specific system knowledge and operating environment. It evaluates the design of application software in the context of the interoperability of system components. Gray box testing consists of methods and tools that draw on the internal knowledge of the application and the environment it interacts with, and can be used in black box testing to enhance testing efficiency, error discovery, and error analysis efficiency. Gray box testing involves input and output, but the tests are designed using information about the code and program operation that is normally outside the tester's field of vision.
purpose task
Software testing is an important part of the software development process. It is used to confirm whether the quality or performance of a program meets some requirements put forward before development. Software testing is the final review of software requirements analysis, design specifications and coding before the software is put into operation, and is a key step in software quality assurance. Software testing is the process of executing a program in order to find bugs. Software testing spans two phases in the software life cycle. Usually, after each module is written, it is necessary to test it (called unit testing). Coding and unit testing belong to the same phase in the software life cycle. After this stage is over, various comprehensive tests will be carried out on the software system, which is another independent stage of the software life cycle, namely the testing stage.
Purpose
The first is to confirm the quality of the software. On the one hand, it is to confirm that the software does what you expect (Do the right thing), and on the other hand, it is to confirm that the software does this event in the correct way (Do it right).
The second is to provide information, such as feedback information provided to developers or program managers, information prepared for risk assessment.
The third software testing is not only testing the software product itself, but also includes the process of software development. If many problems are found after a software product is developed, it means that the software development process is probably flawed. Therefore, the third purpose of software testing is to ensure that the entire software development process is of high quality.
Test task
1. Find bugs;
2. Avoid defects in the software development process;
3. Measure the quality of software;
4. Pay attention to user needs.
Objective
1. To ensure the quality of the software;
2. To improve the software quality function.

Guess you like

Origin blog.csdn.net/u013994400/article/details/126119107