White box testing

Source: Internet
Author: User

White Box Test method:

1 program structure analysis:

The program structure form is the main basis for white box testing. Program structure analysis includes:

1. Control Flow Analysis:

• The control flow chart matrix is used to represent the control flow chart of a program. • The control flow of the analysis program is to make the compiled program have a good structure.

The following four basic requirements are put forward for the program structure:

① Indicates a non-existent turning label;

② Useless statement labels;

③ Statements that cannot be reached after entry from the program;

④ The statement cannot reach the shutdown statement.

Currently, the program control flow analysis is mainly implemented through compilers and program analysis tools.

 

2. Data Stream Analysis:

• Data Stream Analysis is a variable definition that is not defined in the analytics program. • Currently, code compilation and optimization can be performed through data stream analysis using a compiler or program analysis tool.

 

3. Information Flow Analysis:

• Currently, information flow analysis is mainly used to verify the confidentiality of information transmitted between program variables. • Information Flow Analysis Mainly analyzes the relationship between output values and input values. • Information Flow relationships of programs provide useful tools for software development and validation

2. logic coverage:

1. Statement overwrite:

• Structure testing is a test case designed based on the logic structure of the tested program to drive the test completed by the tested program. • An important issue in the structure test is that the test can be completed at any point. That is to say, we need to provide coverage criteria for structural testing.

In order to facilitate the discussion, we will describe various logic overwrites based on a program segment:

If (A> 1) AND (B = 0) then

X = x/

If (A = 2) or (x> 1) then

X = x + 1

"And" and "or" are two logical operators. The figure on the right shows its flowchart. A, B, C, D, and E are program points in the control flow.

This program has four statements, two of which are conditional judgment statements and two value assignment statements.

The meaning of statement overwrite is that during the test, several test cases are designed first, and then the tested program is run so that each executable statement in the program can be executed at least once.

For the above section, the test cases used are: a = 2, B = 0, x = 3 case1

The program is executed by path a c e. In this way, all the four statements in the program segment are executed, thus overwriting the statements.

2. Decision coverage:

Testing Based on decision coverage criteria refers to the design of several test cases to run the program on the side, so that each of the true and false branches in the program will go through at least once, that is, the true or false values are satisfied.

Decision coverage is also called branch coverage.

For example, if two groups of test cases are selected: A = 2, B = 0, x = 3; A = 1, B = 0, x = 1

The path ace and Abd can be executed separately, so that the four branches C, E, and B and D of the two judgments are overwritten respectively.

3. Condition coverage:

Conditional coverage refers to the design of several test cases. After the tested program is executed, the possible values of each condition in each judgment must be met at least once.

4. Decision-condition coverage:

Decision-condition coverage requires the design of sufficient test cases, so that all conditions in the judgment may appear at least once, and each judgment result may also appear at least once.

5. Path coverage:

Testing by path coverage refers to designing enough test cases to cover all possible paths in the program.

6. Test Coverage criteria:

1. Foster's estca coverage criteria

Foster uses a large number of experiments to determine the most error-prone part of the predicates in the program, and obtains a set of Error-sensitive test case analysis estca (Error Sensitive Test Cases Analysis) Rules. In fact, the rule is very simple:

[Rule 1] For a rel B (rel can be <, =, and>) Branch predicates, select the values of A and B as appropriate, when the test is executed to this branch statement, a <B, A = B, and A> B appear respectively.

[Rule 2] for Branch predicates of A rel1 C (rel1 can be> or <, A is a variable, and C is a constant), when rel1 is <, select the value of a as appropriate so that:

A = C-m

(M is the allowed positive number of the smallest container from C. If both A and C are integers, M = 1 ). Similarly, when rel1 is>, select a as appropriate to make:

A = C + m

[Rule 3] assign values to external input variables so that they have different values and symbols in each test case, the values of other variables in the same test case are inconsistent with those in the same group.

3 program plug-in:

• The program plug-in method is simply a method that achieves the purpose of testing by inserting operations into the tested program. • The program plug-in technology can obtain information in various execution processes of the program as required by the user and become an effective means of testing.

4 Introduction to other white box testing methods:

1. Domain testing:

• The "domain" in the domain test refers to the input space of the program. • The input space can be divided into different subspaces, each of which corresponds to a different calculation. • The Division of sub-spaces is determined by the predicates in the branch statements in the program. • The domain test is performed after an appropriate test point is selected based on the analysis of the input domain. • Domain testing has two fatal weaknesses: one is that too many restrictions are imposed on the Program for domain testing, and the other is that when the program has many paths, there are also many test points required. 2. symbol testing: • The basic idea of symbol testing is to allow the program to input not only the specific numerical data, but also the symbolic value. This method is also named for it. • A common test performs arithmetic operations, while a symbolic test performs algebraic operations. Therefore, symbol testing can be considered a natural extension of normal testing. • From the perspective of the usage of the symbol testing method, the key to the problem is to develop compilers and interpreters that are more powerful than traditional compilers and can handle symbol operations. • Currently, there are some issues that have not been satisfactorily solved in the symbol test, which are:

1. Branch Problems

2. Ambiguity

3. Major program Problems

3. Z path Overwrite

4. Program Variation

3. Z path overwrite:

• The ideal scenario for path testing is to overwrite the path, but there are too many paths. Therefore, the circular mechanism is simplified to greatly reduce the number of paths, making it possible to overwrite these limited paths. We call the path overwrite in the simplified loop as the Z path overwrite. • You can use the path tree to represent all the paths in the program. • You can traverse all the leaf nodes to obtain all the paths and generate test cases for each path, you can perform the Z path overwrite test.

4. Program variation:

• The method of program variation is different from the structure test and function test mentioned above. It is an error-driven test. • The error-driven testing method is intended for certain program errors. • There are two main types of error-Driven Testing: Strong Program variation and weak program variation.

White box testing

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.