Equivalence classes It is inappropriate to test by brute force, using every possible input value -Takes a huge amount of time Is impractical -Is pointless You should divide the possible inputs into groups which you believe will be treated similarly by all algorithms -Such groups are called equivalence classes a tester needs only to run one test per equivalence class The tester has to understand the required input appreciate how the software may have been designed www.oseng.com C Lethbridge/Laganiere 2001 Chapter 10: Testing and Inspecting for High Quality 6
© Lethbridge/Laganière 2001 Chapter 10: Testing and Inspecting for High Quality 6 Equivalence classes • It is inappropriate to test by brute force, using every possible input value —Takes a huge amount of time —Is impractical —Is pointless! • You should divide the possible inputs into groups which you believe will be treated similarly by all algorithms. —Such groups are called equivalence classes. —A tester needs only to run one test per equivalence class —The tester has to - understand the required input, - appreciate how the software may have been designed
Examples of equivalence classes Valid input is a month number (1-12 -Equivalence classes are: [-o00[1.12],[13.00 Valid input is one of ten strings representing a type of fuel Equivalence classes are 10 classes, one for each string A class representing all other strings www.oseng.com C Lethbridge/Laganiere 2001 Chapter 10: Testing and Inspecting for High Quality
© Lethbridge/Laganière 2001 Chapter 10: Testing and Inspecting for High Quality 7 Examples of equivalence classes • Valid input is a month number (1-12) —Equivalence classes are: [-∞..0], [1..12], [13.. ∞] • Valid input is one of ten strings representing a type of fuel —Equivalence classes are - 10 classes, one for each string - A class representing all other strings
Combinations of equivalence classes Combinatorial explosion means that you cannot realistically test every possible system-wide equivalence class If there are 4 inputs with 5 possible values there are 54(i.e625)possible system-wide equivalence classes You should first make sure that at least one test is run with every equivalence class of every individual input You should also test all combinations where an input is likely to affect the interpretation of another You should test a few other random combinations of equivalence classes www.oseng.com C Lethbridge/Laganiere 2001 Chapter 10: Testing and Inspecting for High Quality 8
© Lethbridge/Laganière 2001 Chapter 10: Testing and Inspecting for High Quality 8 Combinations of equivalence classes • Combinatorial explosion means that you cannot realistically test every possible system-wide equivalence class. —If there are 4 inputs with 5 possible values there are 5 4 (i.e.625) possible system-wide equivalence classes. • You should first make sure that at least one test is run with every equivalence class of every individual input. • You should also test all combinations where an input is likely to af ect the interpretation of another. • You should test a few other random combinations of equivalence classes
EXample equivalence class combinations One valid input is either Metric'or ' US/Imperial equivalence classes are Metric, US/Imperial, Other Another valid input is maxumum speed 1 to 750 km/h or I to 500 mph validity depends on whether metric or uS/imperial Equivalence classes are -∞.0],[1.500,[501.750],[751.∝ Some test combinations Metric, 1.500 valid US/Imperial, [501..750] Inva Metric,[501.750 va Metric,[501.750 valid www.oseng.com C Lethbridge/Laganiere 2001 Chapter 10: Testing and Inspecting for High Quality
© Lethbridge/Laganière 2001 Chapter 10: Testing and Inspecting for High Quality 9 Example equivalence class combinations • One valid input is either ‘Metric’ or ‘US/Imperial’ —Equivalence classes are: - Metric, US/Imperial, Other • Another valid input is maxumum speed: 1 to 750 km/h or 1 to 500 mph —Validity depends on whether metric or US/imperial —Equivalence classes are: - [-∞..0], [1..500], [501..750], [751.. ∞] • Some test combinations - Metric, [1..500] valid - US/Imperial, [501..750] invalid - Metric, [501..750] valid - Metric, [501..750] valid
Testing at boundaries of equivalence classes More errors in software occur at the boundaries of equivalence classes The idea of equivalence class testing should be expanded to specifically test values at the extremes of each equivalence class e. g The number 0 often causes problems E. g. If the valid input is a month number(1-12) Test equivalence classes as before Test 0, 1, 12 and 13 as well as very large positive and negative values www.oseng.com C Lethbridge/Laganiere 2001 Chapter 10: Testing and Inspecting for High Quality
© Lethbridge/Laganière 2001 Chapter 10: Testing and Inspecting for High Quality 10 Testing at boundaries of equivalence classes • More errors in software occur at the boundaries of equivalence classes • The idea of equivalence class testing should be expanded to specifically test values at the extremes of each equivalence class —E.g. The number 0 often causes problems • E.g.: If the valid input is a month number (1-12) —Test equivalence classes as before —Test 0, 1, 12 and 13 as well as very large positive and negative values