White-box testing-five methods of logical path coverage and physical path coverage (1)

Source: Internet
Author: User
I, Statement path Overwrite: It is a relatively weak logical path coverage standard. By selecting enough test cases, every statement of the program to be tested is executed at least once when these cases are run. Example:
Test Cases Input Expected output Tested path
TC1 X = 4, y = 2, Z = 0 X = 3 Sacbed (Red Route)
II, Determine path Overwrite: Slightly stronger than statement path overwrite. By designing enough test cases, every decision in the program can obtain "true" and "false" at least once ". Or make every branch in the program pass at least once. Example:
Test Cases Input Expected output Test path
TC2 X = 1 y = 3 Z = 0 X = 1/3 Sacbd (red)
TC3 X = 3 Y = 2 z = 1 X = 4 Sabed (blue)
III, Conditional path Overwrite: A sufficient number of test cases should be designed for each of the several conditions contained in a decision. Yes, each condition in the decision should receive at least one opportunity of "true" and "false. That is to say, the result of each condition must appear at least once. The difference between Decision Path coverage and conditional path coverage: 1. determination refers to every square shape in the process, and Condition refers to every condition in the square shape. 2. Determining the path focuses on Each branch after determinationMust be overwritten. Where each condition is true or not trueMust be overwritten. 3. for example, if the condition (x> 1) is true or not true, the condition is true when x = 2, and the condition x = 0 is not true; for example, the condition (x> 1 & Y = 0, the sub-conditions x> 1 and Y = 0 must be analyzed separately. X = 2, y = 0 make x> 1 true, y = 0 true; X = 0, y = 1 is x> 1 not true, y = 0 is not true. Example:
Test Cases Input Expected output Test path
C4 X = 0 y = 2 z = 0 X = 1 Sacbed (red)
TC5 X = 2 y = 1 Z = 1 X = 3 Sabed (blue)
For further explanation, there are four conditions (Y> 1), (Z = 0), (y = 2), and (x> 1 ); when designing use cases, make them all appear "True Value" and "false value" at least once. TC5 covers the values of the "true" and "false" conditions at least once. Iv. Decision/condition path Overwrite: By designing enough test cases, all possible results of each condition in the determination appear at least once when these test cases are run, and all possible results of each decision also appear at least once. That is, the combination of decision and conditional path coverage. Example:

Test Cases Input Expected output Test path
TC6 X = 4 Y = 2 z = 0 X = 3 Sacbed (red)
Tc7 X = 1 y = 1 Z = 1 X = 1 Sabd (blue)
 

 

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.