White box Test (program Flowchart) __ White box test

Source: Internet
Author: User
White-Box testing is also called structural testing, transparent box testing, logical drive testing, or code based testing. White box testing is a test case design method, the box refers to the software tested, white box refers to the box is visible, you know the inside of the box and how it works inside. The White box method fully understands the internal logic structure of the program and tests all logical paths. The "white Box" method is the exhaustive path test. When using this scenario, the tester must check the internal structure of the program, start with the logic of the check program, and draw the test data. The number of independent paths through the program is astronomical. White-Box testing is a typical test method
• A test method that designs test data and completes tests according to the internal logic structure and coding structure of the program
− test overwrites all code, branch, path, and condition
− It uses the information that is available to view the functionality and implementation of the code to determine what needs to be tested, what is not, and how to start the test
− also known as structural test or logic driven test  white box test features mainly
·1. Can form test data to allow specific program parts to be tested
2. Have a certain measure of adequacy
3. More tool support available
4. Typically used only for unit tests and integration tests (primarily unit tests) the basic test content for white-box testing
 Basic Test Content
• Test all independent execution paths for the program module at least once
• For all logical decisions, take both "true" and "false" to test at least once
• Execute the loop body within the bounds of the loop and the bounds of the operation
• Test the effectiveness of internal data structures
The test method used in  white box test is
• Logical overlay (including statement overrides, branch coverage, conditional overrides, branch-condition overrides, conditional combination overrides, and path overrides)
Six kinds of logic coverage standards: statement coverage, decision coverage, conditional coverage, decision/condition coverage, conditional combination coverage and path coverage found errors in the ability to be weak to strong change.
statement Overwrite requirement: Execute the path independently at least once. Each statement is executed at least once.
• It has little logical coverage of the program and is a weak logical coverage standard
• In order to test the program more fully, you need to adopt the other logical overlay methods described later
• In order to expose errors in the program, statement coverage is the minimum test requirement, requiring enough test cases to be designed so that each statement is executed at least once
• The advantages of statement coverage
• Check all statements
* Simple structure of the code to test the effect of better
• Easy to implement automated testing
• High Code Coverage
• If the program block is overwritten, do not consider the source code in the program block
Statement overwrite errors that cannot be checked out are
• Conditional statement error, logical operation error, circular statement error

Decision coverage requirements: logical judgment at least once. Each branch of each decision is executed at least once.
Requires design to do enough test cases so that each branch of the program is passed at least once
• The true and false values of each branch statement are executed at least once
while statements, switch statements, exception handling, jump statements, and three-mesh operators (a. B:C), and so on, you can also use branch overlay to test
• For multiple-spoke statements, such as Case statements in C, a branch overlay must test every possible result for each branch
The decision coverage is better than the statement coverage error-checking ability:
• A branch overlay is performed, and statement coverage is actually performed
The same disadvantage of decision overlay and statement coverage
• Can not detect conditional statement errors, can not detect logical operation errors, can not detect the number of cycle errors, can not detect the cycle conditions error

conditional Coverage Requirements: Each condition for each decision should be taken to a variety of possible values.
Not only does every statement execute at least once, so that each condition in the decision gets a variety of possible results
The decision overlay is concerned only with the result of the whole decision expression, and the conditional coverage is the result of each condition with various values.
The pros and cons of conditional coverage
− can check all the conditional errors
− does not implement checks on each branch
Increased number of − Use cases

decision/Condition coverage requirements: At the same time to meet the decision coverage condition coverage.
Design enough test cases so that all possible values for each condition in the decision can be obtained at least once, and all possible decisions of each judgment are executed at least once
− used to resolve conditional overrides does not necessarily include a decision overlay, nor does a decision overlay necessarily include a problem with conditional coverage
The pros and cons of branching-conditional coverage:
− considers every condition and every branch, and finds fault capability stronger than branch coverage and conditional coverage
− does not fully cover all paths
Increase in the number of − Use cases

Conditional combination Coverage Requirements: each combination of conditions in each decision appears at least once.
Requires a sufficient number of test cases to be designed so that the various combinations of conditions in each decision appear at least once
Test cases that meet the criteria of combination coverage standard, also must meet the judgment coverage, condition coverage and decision/condition coverage standard
• Conditional combination coverage is the strongest of the previous coverage standards
• However, test cases that meet the requirements of conditional combination overrides do not necessarily enable each path in the program to

Path override requirements: Make every possible path in the program execute at least once. All entrance tests. (full Coverage) coverage: logic and function overrides = items/Total item at least once. Symbols for program Flowchart:

program diagram
Definition: Given a program written in an imperative programming language, the program diagram is a graph of direction, in which:
• Traditional definition:
• A node is a program statement that represents a control flow (a side from node I to node J, when and only if the statement of the corresponding node J can be executed immediately after the statement corresponding to node i).
• Improved definition:
• The node is either the entire statement or part of the statement, and the edge represents the control flow (a side from node I to node J that can be executed immediately after the statement or part of the corresponding node J) that
is part of the statement or statement of the node I.
The
most famous form of dd-path structural testing is based on the structure called Decision making path (dd-path). The
dd-path refers to a sequence of statements from the "way out" of the decision statement to the end of the "approach" of the next decision statement, in which there is no internal branch.
dd-Path definition
: Given a program written in an imperative language, the dd-path map is a direction graph. Where the node represents the dd-path of its program diagram, and the edge represents the control flow between successive dd-paths. In
fact, the dd-path map is a compression diagram in which a 2-connection component is compressed dd-a single node of the path.
The purpose of the dd-path is to propose that the dd-path can describe the test coverage very precisely.
compresses the diagram node between the exit of the Last Judgment and the next one to a node.

The ring complexity (McCabe metric) is a software metric that provides quantitative measures for program logic complexity, which is used to calculate the number of basic independent paths for a program, and to ensure that all statements are executed at least once in the upper bounds of the measure quantity.
The complexity of the loop depends on the complexity of the program structure. It is a quantitative measurement of the difficulty of testing, but also can give some prediction of the final reliability of software.
calculation method:
1, Flow diagram G ring complexity V (g) = region number
2, flow graph G ring complexity V (g) =e-n+2, where E is the number of edges in the flow diagram, N is the knot.
3. The annular complexity V (g) =p+1 of the flow graph G, where P is the number of branch points in the flow graph.
4, Flow diagram G of the annular Complexity V (g) =m-n+p. (M is an arc, n is a node number, p is a strong connected component (0 nodes plus 1))
In the direction of graph G, if two vertices vi,vj (VI>VJ) has a direction path from VI to VJ, and there is a direction path from VJ to VI, the two vertices are called strong-connected. The maximal strongly connected subgraph of a direction graph is called a strongly connected component (strongly connected components).
Example: Complexity: 6 degree of complexity: 3

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.