Differences between conditional coverage, path coverage, statement coverage, and branch coverage in software testing

Source: Internet
Author: User
Differences between conditional coverage, path coverage, statement coverage, and branch coverage in software testing

 

For example
If a and B then Action1
If C or D then Action2

The statement overwrites the weakest. Program All the statements in can be executed once. In the above example, you only need to design a test case so that a = true B = true c = true.

Branch coverage, also known as decision coverage, allows each decision in the program to take the true branch and take the false branch at least once, that is, the true and false of the judgment have been satisfied. In the above example, You need to design a test case so that it meets the following conditions respectively (1) A = true, B = true, c = true, D = false (2) A = true, B = false, c = false, D = false.

Condition coverage: the possible values of each condition in each judgment must be met at least once. In the above example, the first judgment should take into account a = true, A = false, B = true, B = false. The second judgment should take into account c = true, c = false, D = true, D = false, so in the above example, you can design a test case to meet the following conditions: (1) A = true, B = true, c = true, D = true (2) A = false, B = false, c = false, D = false.

Path overwrite: overwrite all possible paths in the program. Therefore, you can design test cases to meet the following conditions: (1) A = true, B = true, c = true, D = true (2) A = false, B = false, C = false, D = false (3) A = true, B = true, c = false, D = false (4) A = false, B = false, c = true, D = true.

No matter the method of overwriting, the correctness of the program cannot be guaranteed.

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.