1 / 15

Software Testing

Software Testing. Component testing Testing of individual program components Usually responsibility of developer Tests derived from developer’s experience Integration testing Testing of groups of components integrated to create system or sub-system

aizza
Download Presentation

Software Testing

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. Software Testing • Component testing • Testing of individual program components • Usually responsibility of developer • Tests derived from developer’s experience • Integration testing • Testing of groups of components integrated to create system or sub-system • Responsibility of independent testing team • Tests based on a system specification Ch20 - Software Testing I

  2. Defect Testing • Goal:to expose latent system faults • Test cannot guarantee absence of faults • Exhaustive testing impractical • Successful defect test: • one which causes system to misbehave •  finds a fault Ch20 - Software Testing I

  3. Defect Testing Process Ch20 - Software Testing I

  4. Black-box Testing • Tests based on inputs, expected outputs • Developed from specification, not implementation • How to select good test inputs? • Domain knowledge • Equivalence partitioning Ch20 - Software Testing I

  5. Equivalence Partitioning • Divide inputs into equivalenceclasses, apply test cases from each class • Typical value (e.g. midpoint) • Boundary conditions • Kinds of equivalence classes • Valid/invalid inputs • Inputs for which system behave similarly • No need to test with incorrect arg types Ch20 - Software Testing I

  6. Equivalence PartitioningExamples • Function to determine abs • Function to determine sin • Four quadrants: 0°-90°, 90°-180°, 180°-270°, 270°-360° • Searching for removing an element value from a list Ch20 - Software Testing I

  7. Remove routine specification procedure Remove (Key : ELEM ; T: ELEM_ARRAY; Found : in out BOOLEAN; L: in out ELEM_INDEX) ; Pre-condition -- the array has at least one element T’FIRST <= T’LAST Post-condition -- the element is not present in the sequence ( not Found and not (exists i, T’FIRST >= i <= T’LAST, T (i) = Key )) Ch20 - Software Testing I

  8. Remove routine input partitions • Inputs which conform to the pre-conditions • Inputs where a pre-condition does not hold • Inputs where the key element is a member of the array • Inputs where the key element is not a member of the array Ch20 - Software Testing I

  9. Testing guidelines (sequences) • Tests when input argument is a sequence • with sequence length = 1 • with sequence length = 0 • with sequence length >> 0 • Different-length sequences • “Tickle” the first, middle and last elements of the sequence Ch20 - Software Testing I

  10. White-box (Structural) Testing • Derive tests from study of implementation • Goal is to exercise all independent program paths (every statement) • not all dynamic paths through the program (not feasible) • Stronger, hard to do manually for complex programs • Dynamic program analyser can check paths have been executed Ch20 - Software Testing I

  11. Program flow graphs • Each basic block is a node • Each branch is shown as a separate path; loops are drawn as arrows looping back to the loop condition node • Cyclomatic complexity = Number of edges - Number of nodes + 2 Ch20 - Software Testing I

  12. Program flow graphsExample bool Remove(int key, intarray& array) { int origSize = array.size(); for (int i = 0; i < array.size(); i++) { while (array[i] == key) { int limit = array.size(); for (int j = i; (j+1) < limit; j++) { array[j] = array[j+1]; } array.shrink(-1); } } return (array.size < origSize); } Ch20 - Software Testing I

  13. Program flow graphsExample bool Remove(int key, intarray& array) { int origSize = array.size(); for (int i = 0; i < array.size(); i++) { while (array[i] == key) { int limit = array.size(); for (int j = i; (j+1) < limit; j++) { array[j] = array[j+1]; } array.shrink(-1); } } return (array.size < origSize); } A B C D E F G H I Ch20 - Software Testing I

  14. Program flow graphsExample END START A B I H C D F E G Ch20 - Software Testing I

  15. Program flow graphsExample • Cyclomatic Complexity = 11 – 9 + 2 = 4 • Therefore, 4 Traces • A, B, I • Array of zero length • A, B, C, H, I • Array with no key in any slots • A, B, C, D, E, G, H, I • Array with key just in last slot • A, B, C, D, E, F, G, H, I • Array with key in some slots (but not just last slot) Ch20 - Software Testing I

More Related