Download
software testing and quality assurance n.
Skip this Video
Loading SlideShow in 5 Seconds..
Software Testing and Quality Assurance PowerPoint Presentation
Download Presentation
Software Testing and Quality Assurance

Software Testing and Quality Assurance

134 Vues Download Presentation
Télécharger la présentation

Software Testing and Quality Assurance

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Software Testing and Quality Assurance Lecture 7 - Software Testing Techniques

  2. Lecture Outline • Discuss Equivalence Partitioning • How to select test cases based on equivalence Partitioning. • Discuss Boundary-value Analysis • How to select test cases based on boundary-value analysis.

  3. Equivalence Partitioning • Partition the input of a program using the functional requirements. • Test inputs are executed on the program, and • The tester evaluates whether the output of the program is in the expected output domain.

  4. Choosing Equivalence Classes • Aim is to minimize the number of test cases required to cover all of the Equivalence Classes (EC). • Identify the initial EC. • Identify overlapping EC, and • Eliminate them by making the overlapping part a new equivalence classes. • Select one element from each EC as the first test input; and • Work out the expected result for that test input.

  5. Identify initial equivalence classes • No clear formula • We need to build up some judgment and intuition. • Guidelines to identify potential EC. • We may need to choose extra cases in order to explore difficult subsets of the input domain.

  6. Identify initial equivalence classes - Guidelines • Input condition specifies range of vales, • Identify one valid EC • Two invalid EC • One for the set of values below the range • One for the set of values above the range. • For example, range of values 1…. 99, • The valid EC 1…99; and • Two invalid EC i.e. {x | x < 1} and {x | x > 99}

  7. Identify initial equivalence classes - Guidelines • Input condition specifies a set of input values. • A valid EC for each element of the set, and • One EC class for the elements not in the set. • For example, input selected from a set of N inputs, we need N + 1 EC; • One valid EC for each element of set,and • One invalid EC for element outside the set.

  8. Identify initial equivalence classes - Guidelines • Input condition specifies a ‘must be’ situation, • Identify one valid EC and one invalid EC. • For example, if character input must be numeric, we need two EC • A valid EC --- { s | the first character of s is a numeric} • One invalid EC --- {s | the first character of s is not a numeric}

  9. Identify initial equivalence classes - Guidelines • If program handles each valid input differently, then • define one valid EC per valid input. • For example, input from a menu • Define one valid EC for each menu item. • If elements in EC are handled differently by the program, then • Split the EC into smaller EC Some of the guidelines are very general in nature. Domain knowledge and experience plays a key role in identifying EC.

  10. Eliminating Overlapping EC Overlapping EC EC 2 EC 1

  11. Eliminating Overlapping EC - Example Disjoint EC • A - an empty list • B - list with one element • C - list with at least two element • D - a sorted list; and • E - an unsorted list Two or more elements are either sorted or unsorted. • Unsorted list with at least 2 elements. • Sorted list with at least 2 elements.

  12. Selecting Test Cases • Once EC have been identified • Any value from EC is identified to be as likely to produce a failure as any other value in that class. • Thus, any element of the class servers as a test input. • However, selecting just any value in EC may not be optimal for finding faults. • For example, faulty implementation of square function.

  13. Important Question? • How to resolve the overlap so that we do not derive too many test cases?

  14. Boundary-value Analysis (BVA) • Greater number of errors occur at the boundaries of the input domain. • Select test cases to explore the boundary conditions of a program. • BVA complements equivalence partitioning. • Rather then selecting any element from EC, • BVA leads to the selection of test cases at the ‘edges’ of the class.

  15. Boundary-value Analysis • Faults are more likely to introduced at boundary because • Unsure of the correct boundary for an input condition; • Have incorrectly tested the boundary.

  16. Example - Triangle Program • A program reads floating point values from the standard input. • The three values are interpreted as representing the lengths of the sides of a triangle. • Program prints a message that states whether the triangle is • Equilateral, isosceles, scalene or invalid.

  17. Example - Triangle Program • Equilateral triangle • Only one boundary where x = y = z. • Test cases to explore this boundary • (3,3,3) On Point • (2.99, 3, 3) Off Point Below • (3.001,3,3) Off Point Above

  18. Example - Triangle Program • Isosceles Triangle • x = y AND y ≠z, y = z AND z ≠x ….. • Test cases to explore the boundary x = y AND y ≠z • (3,3,4) On Point • (2.99, 3, 4) Off Point Below • (3.001,3,4) Off Point Above

  19. Boundary-value Analysis - Guidelines • Input condition specifies a range bounded by values a and b, • test cases should designed with values a and b as well as just above and just below a and b. • Input condition specifies a number of values, • Test cases should check the minimum and maximum numbers.

  20. Boundary-value Analysis - Guidelines • Guidelines 1 and 2 are applied to output domain as well. • A program generates temperature vs pressure table. • Test case should create output that produces maximum (and minimum) allowable number of table entries.

  21. Boundary-value Analysis and Equivalence Partitioning • One or more test cases be selected from the edge of the EC or close to the EC. • Simply requires that any element in the equivalence class will do. • Test cases be derived from the output conditions. • Only the input domain is usually considered.

  22. Key points • Equivalence partitioning is one of the oldest and still most widely used method for selecting test cases based on a partitioning of the input domain. • Boundary conditions are predicates that apply directly on, above, and beneath the input boundaries of input and output EC.