Mccabe metric calculation and path coverage of soft exam test points

Mccabe metric calculation and path coverage of soft exam test points

[First half of 2023]

34, 35. In the flow chart below, at least (34) test cases are required to cover all paths. Using McCabe's method to calculate the program complexity is (35)

 


  1. A. 3B
    . 4C
    . 5D
    . 6
    (35)
    A.2B
    . 3C
    . 4D
    . 5.
    Information pipe network reference answers: B, C

Analysis:

 

4 drawings are shown.

 V(g)=m-n+2=13-11+2=4

Infer three cases from one instance: use the white box test method to test the flow chart shown in the figure below. If path coverage is to be satisfied, at least (32) test cases are required. The cycle complexity of the program is calculated by McCabe metric as (33).

 

Reference answer analysis:  6, 4

 

This question tests the basic knowledge of software testing. White box testing and black box testing are the two most commonly used software testing methods. Path coverage is a specific method of white-box testing. Path coverage refers to designing several test cases to cover all paths in the program. Path coverage should cause every possible path in the program to be executed at least once. There are six paths in this flowchart ①②③④⑤⑥⑦⑧, ①②③④⑤⑥⑧, ①②③⑤⑥⑦⑧, ①②③⑤⑥⑧, ①②⑥⑦⑧, ①②⑥ ⑧, Therefore, 6 test cases are required to achieve path coverage to the first step.

The McCabe measurement method is a complexity measurement method based on program control flow. The cycle complexity is V(G)=m-n+2, in the figure m=10, n=8, V(G)= 10-8 +2=4.

The McCabe complexity measure is also called the cycle measure, and its calculation formula is:  V(g)=m-n+2 , where m and n represent the number of edges and vertices in the graph, respectively .

Guess you like

Origin blog.csdn.net/ck3345143/article/details/132235942