1 / 12

Extra tutorial notes

Extra tutorial notes. Revision. Statement coverage and Branch coverage. Statement coverage – “Execute all statements in the program at least once under some test.”

kyne
Télécharger la présentation

Extra tutorial notes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Extra tutorial notes

  2. Revision

  3. Statement coverage and Branch coverage • Statement coverage – “Execute all statements in the program at least once under some test.” • Branch coverage – “Execute enough tests to assure that every branch alternative has been exercised at least once under some test.” References: Boris Beizer, Software Testing Techniques 2nd edition, 1990 (page 74).

  4. Exercises

  5. Revision

  6. Notes • Assuming that red dots are global definition and green dot is the global c-use. • **The following is not a du-path: • Hence, when you are answering du-paths questions, please make sure that the path fulfills the requirements.

  7. x=read(x) y=read(y) max=x x<y 1 2 3 4 x>y max = y 5 Exercise • Findpaths for x that satisfy the following criteria: • All-defs: • All-uses: • All-p-uses: • All-c-uses: • All-du-paths:

  8. x=read(x) y=read(y) max=x x<y 1 2 3 4 x>y max = y 5 Exercise • Findpaths for x that satisfy the following criteria: • All-defs: {1,2,3} • All-uses:{1,2,3}, {1,2,3,4}, {1,2,3,5}, • All-p-uses: {1,2,3,4}, {1,2,3,5} • All-c-uses: {1,2,3} • All-du-paths = all-uses + {1,2,3,4,5}

  9. Another testing questions

  10. Suggested solutions • 0 • 0, 1 • Not possible because the loop does not have a fixed upper bound. We don’t know the value of “n” to execute the loop n-1, n and n+1 times. • Infinite number of test cases because the loop does not have a fixed upper bound. • Global definition: 1-2-3-4-5, 9-10 Global c-uses: 9-10, 11 du-paths: 1-2-3-4-5  9-10 1-2-3-4-5  7  9-10 1-2-3-4-5  11 9-10  9-10 9-10  11

  11. An extra question • Propose test cases to achieve all-du-paths criterion of the variable “factorial”.

  12. Solutions • 3 test cases: 3, 1, 0. • Remarks: • N = 3 • 1-2-3-4-5  9-10  9-10  11 • N = 0 • 1-2-3-4-5  7  9-10  11 • N = 1 • 1-2-3-4-5  11

More Related