Logical covering method and basic path method

Source: Internet
Author: User

Logical Coverage method

Logical overlay is a test case design technique based on the logical structure inside the program, which requires the tester to have a clear understanding of the logical structure of the program. The logic overlay can be divided into: statement overlay, decision coverage, conditional coverage, decision-conditional override, conditional combination overlay and path overlay.

1. The statement overlay is the design of several test cases, running the program, so that each executable statement executes at least once.

2. The decision to cover is to design several test cases, run the program, so that the process of each judgment of the true branch and take the false branch at least once.

3. Conditional coverage is the design of a number of test cases, running the program, so that each judgment of each condition of the program can be evaluated at least once.

4. Determination-Conditional coverage is the design of sufficient test cases to allow all possible values for each condition in the judgment to be executed at least once, and at least once for all possible judgements of each judgment.

5. The conditional combination override is to design enough test cases to run the program, so that all possible combinations of conditional values for each judgment are executed at least once.

6. The path test is to design enough test cases to overwrite all possible paths in the program.

Each coverage method has its advantages and disadvantages, these 6 kinds of coverage method relationship, 1:

Figure 1

Typically, you should design your test case to select an override method based on the complexity of the code module. The complexity of the general code is proportional to the complexity of the test case design. Therefore, the designer must do the module or method function of the unitary, cohesion, make the method or function code as simple as possible, this will greatly improve the test case design ease, improve the coverage of test cases.

Basic Path method

The basic path test method is to design the test case by analyzing the loop complexity of control structure and exporting the basic executable path collection based on the program flow graph. The test cases are designed to ensure that each executable statement of the program is executed at least once in the test. The basic path test method consists of the following 5 aspects:

1. Control flow Diagram of the program: A graphical method that describes the program flow.

2. Complexity of the program environment: McCabe complexity measurement; from the program's loop complexity, you can export the number of independent path bars in the collection of program base paths, which is the upper bound of the number of test cases that must be executed at least sequentially for each executable statement in the program.

3. Export the test case.

4. Prepare the test case to ensure the execution of each path in the base path set.

5. Graph Matrix: It is a software tool that plays an auxiliary role in the basic path test, which can be used to automatically determine a basic path set.

In addition, for the choice of test cases in addition to meet the selected coverage (or coverage criteria), it is necessary to use the boundary value analysis method, error inference method and other commonly used design methods. The boundary value analysis method is used to design reasonable input conditions and unreasonable input conditions. The conditional boundary test case should include the boundary of the input parameter and the conditional boundary (If,while,for,switch, SQL WHERE clause, etc.). The error-guessing method, which lists all possible errors in the program and the special cases prone to errors, selects test cases according to them, and can find many common errors and suspected errors in the coding, Unit testing phase, which should be used as a key test for these errors and the corresponding test cases should be designed.

Logical covering method and basic path method

Related Article

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.