Software Test Job essay three: Printprime () after-school questions (a) (b) (c) (d)

Source: Internet
Author: User

(a) Draw a control flow graph for the Printprime () method.

This diagram I use Word completion, very tired, and then think of me and omnigraffle but too late, the figure is as follows:

(b) Consider test case t1= (n=3) and t2= (n=5). Even though these test cases travel the same main path in the Printprimes () method, they do not necessarily find the same error. Design a simple error that makes T2 easier to spot than T1.

A: If the N value is large, t2= (n=5) will be prone to data out-of-bounds errors.

(c) for Printprimes (), find a test case that allows the test path of the response to access the connection while the statement starts at the edge of the for statement without passing through the while loop body.

A: Find the test case n = 1, do not meet the conditions of Numprimes < N, so that the response test path Access connection While statement starts to the side of the for statement, instead of passing through the while loop body.

(d) The legend for Printprimes () lists the test requirements for each node overlay, Edge overlay, and master path overlay.

Answer: 1) node Overlay: TR = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}

2-side overlay: TR = {(2,3), (2,12), (3,4), (4,5), (5,6), (6,7), (6,8), (7,5), (8,9), (5,9), (9,10), (9,11), [10,11], (11,2), (12, 13), (13,14), (14,15), (15,13), (13,16)}

3) Main Path overlay:

TR = {(1,2,3,4,5,6,7),

(1,2,3,4,5,6,8,9,10,11),

(1,2,3,4,5,6,8,9,11),

(1,2,3,4,5,9,10,11),

(1,2,3,4,5,9,11),

(1,2,12,13,14,15),

(1,2,12,16),

(2,3,4,5,6,8,9,10,11,2),

(2,3,4,5,6,8,9,11,2),

(2,3,4,5,9,10,11,2),

(2,3,4,5,9,11,2),

(3,4,5,6,8,9,10,11,2,12,13,14,15),

(3,4,5,6,8,9,11,2,12,13,14,15),

(3,4,5,6,8,9,10,11,2,12,13,16),

(3,4,5,6,8,9,11,2,12,13,16),

(3,4,5,9,10,11,2,12,13,14,15),

(3,4,5,9,11,2,12,13,14,15),

(3,4,5,9,10,11,2,12,13,16),

(3,4,5,9,11,2,12,13,16),

(5,6,7,5),

(6,7,5,9,10,11,2,12,13,14,15),

(6,7,5,9,11,2,12,13,14,15),

(6,7,5,9,10,11,2,12,13,16),

(6,7,5,9,11,2,12,13,16),

(13,14,15,13),

(14,15,13,16),

}

Software Test Job essay three: Printprime () after-school questions (a) (b) (c) (d)

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.