The legendary interview is mandatory-> six white-box testing methods

Source: Internet
Author: User
First, I would like to introduce some nonsense: White box testing objective: Overwrite the logical path in the software by checking the internal logical structure of the software; set up checkpoints in different places of the program to check the program status, to determine whether the actual running status is consistent with the expected status. White box test features: Perform tests based on the software design specification, strictly inspect internal program details, design test cases for specific conditions, and perform coverage tests on the logical path of the software.

White box test implementation steps:

1. Test plan stage: Develop the test progress according to the requirement specification.
2. Test Design Phase: divide the software structure and design test cases according to the program design specification according to certain standardized methods.
3. test execution phase: Enter the test case to obtain the test result.
4. Test Summary stage: Compare the test results with the expected results of the Code, analyze the cause of the error, and locate and solve the error.

 

Advantages of white box testing:

1. Force testers to think carefully about software implementation

2. Check each branch and path in the code.
3. reveal errors hidden in code
4. complete code Testing


Disadvantages of white box testing:

1. Expensive
2. failed to detect missing paths and data sensitivity errors in the code
3. Do not verify the specification correctness

 

Part 2 (test method description ):

 

I. Statement Overwrite

1. Features: statement coverage is the minimum structure coverage requirement. statement coverage requires a sufficient number of test cases to be designed so that each statement in the program can be executed at least once.

2. Advantages: You can obtain test cases from the source code without dividing each judgment expression.

3. Disadvantages: This test method is only applicable to statements explicitly in the program logic, but cannot be tested for hidden conditions and potential Implicit logical branches.

 

Ii. Decision coverage

1. Features: Decision coverage, also known as branch coverage, requires that a sufficient number of test cases be designed to make each decision in the program at least one true value and one false value, that is: each branch in the program must be executed at least once. Each true or false judgment must be performed at least once.

2. Advantage: the coverage test path is almost twice as much as the coverage test path of a statement. Of course, the coverage test capability is stronger than that of a statement. Similarly, the overwrite method has the same simplicity as the overwrite method. You can obtain test cases without dividing each criterion.

3. Disadvantages: Most judgment statements are usually composed of multiple logical conditions. If you only judge the entire final result and ignore the value of each condition, some test paths are missing.

 

Iii. Conditional coverage

1. features: a sufficient number of test cases must be designed for condition coverage, so that each condition in the determination can obtain various possible results, that is, each condition is at least one true value and one false value.

2. Advantage: Obviously, the coverage ratio of the condition is higher than the coverage ratio, and the test path is added.

3. Disadvantages: sufficient test cases are required to achieve the coverage of conditions, but the coverage of conditions cannot be guaranteed. Conditional overwrite only ensures that each condition is true at least once, regardless of all judgment results.

 

Iv. Decision/condition coverage

1. Features: Design enough test cases to make all possible results of each condition appear at least once, and all possible results of each criterion also appear at least once.

2. Advantages: the decision/condition coverage meets the decision coverage criteria and condition coverage criteria, making up for the shortcomings of both.

3. Disadvantages: the disadvantage of the criterion for determining/covering conditions is that conditions are not considered.

 

5. combined coverage

1. features: a sufficient number of test cases must be designed to make all possible combinations of conditions in each decision appear at least once.

2. Advantages: the multi-condition coverage criteria meet the criteria for determining coverage, conditional coverage, and decision/condition coverage. The modified judgment/condition overwrite requires that a sufficient number of test cases be designed, so that all possible results of each condition in the determination appear at least once, and all possible results of each decision itself also appear at least once. In addition, each condition is shown to affect the judgment result separately.

3. disadvantage: linearly increase the number of test cases.

 

6. Path coverage

1. Features: Design enough test cases to cover all possible paths in the program.

2. Advantages: This test method can thoroughly test the program, which is wider than the previous five methods.

3. Disadvantages: Because Path coverage requires testing all possible paths (including loops, condition combinations, and Branch selection), a large number of complex test cases need to be designed, this increases the workload exponentially. In some cases, some execution paths cannot be executed.

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.