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

  • Published on
    20-Dec-2015

  • View
    216

  • Download
    2

Embed Size (px)

Transcript

<ul><li> Slide 1 </li> <li> 1 Software Testing and Quality Assurance Lecture 7 - Software Testing Techniques </li> <li> Slide 2 </li> <li> 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. </li> <li> Slide 3 </li> <li> 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. </li> <li> Slide 4 </li> <li> 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. </li> <li> Slide 5 </li> <li> 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. </li> <li> Slide 6 </li> <li> 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 199; and Two invalid EC i.e. {x | x 99} </li> <li> Slide 7 </li> <li> 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. </li> <li> Slide 8 </li> <li> 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} </li> <li> Slide 9 </li> <li> 9 Some of the guidelines are very general in nature. Domain knowledge and experience plays a key role in identifying EC. 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 </li> <li> Slide 10 </li> <li> 10 Eliminating Overlapping EC EC 1 EC 2 Overlapping EC </li> <li> Slide 11 </li> <li> 11 Eliminating Overlapping EC - Example 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 Disjoint EC Two or more elements are either sorted or unsorted. Unsorted list with at least 2 elements. Sorted list with at least 2 elements. </li> <li> Slide 12 </li> <li> 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. </li> <li> Slide 13 </li> <li> 13 Important Question? How to resolve the overlap so that we do not derive too many test cases? </li> <li> Slide 14 </li> <li> 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. </li> <li> Slide 15 </li> <li> 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. </li> <li> Slide 16 </li> <li> 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. </li> <li> Slide 17 </li> <li> 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 </li> <li> Slide 18 </li> <li> 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 </li> <li> Slide 19 </li> <li> 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. </li> <li> Slide 20 </li> <li> 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. </li> <li> Slide 21 </li> <li> 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. </li> <li> Slide 22 </li> <li> 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. </li> </ul>

Recommended

View more >