Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
When dealing with GVs (Gate Variables) this assumption is not true
if (amount <= 1800) Total = amount else if (amount > 1800 .AND. amount < 15000) Total = amount * tax_rate[1] else Total = amount * tax_rate[2]
3 paths
We say that the variable amount has three equivalence classes For the time being we ignore out-of-range values
Equivalence classes
Equivalence classes
x1
1800
15000
amount
Boundary values
Boundary values
Equivalence classes
Definition
Aims
Equivalence class testing strategy is developed with the following aims To test as few input values as possible To spot and eliminate redundant tests To tell how many tests are necessary to test a given piece of software to a known level
Two input values are in the same equivalence class if they are treated in the same way according to the specification, i.e they cause the same path to be executed.
Domain set A
Example problem
Calculating the Correction
Example problem
Calculating the Correction
Base
New
Type
New Y N
Type A B C X
Definitions
Path Coverage A set of test achieves Path Coverage if it contains at least one test that goes down each path in the piece of code under test Code coverage A set of tests achieves Code Coverage if it contains at least one test that (potentially) executes each line of code in the piece of code under test.
r c a b
r c
x1
x1
r c a b
r c
x1
x1
r c a b
x1
Any questions?
Vehicle type
Cars Trucks Vans Motorcycles
Age
<21 21 - 65 > 65
Q: A:
"Do you treat all ages the same way (even though they give a different number for the quote?)" "Well, not exactly. There are three classes of age: the under 21 kids, the great middle aged group from 21 to 65, and the Golden Oldies who are over 65. We do it differently for each group."
Age
<21 21 - 65 > 65 > 65 21 - 65 <21
Trucks
Vans
Motorcycles
4 = max (4, 3)
<21 21 - 65 > 65
> 65 21 - 65 <21
Trucks
Vans
Motorcycles
12 = 4 x 3
12 = 4 x 3 - 2
If an input is used to compute more than one output, do you think it could have different Equivalence Classes (ECs) for the different outputs, or are the ECs the same? Compute the percentage reduction of the number of test cases in the example above, when each of the input variables has 3 equivalence classes ( this is more realistic than 10 equivalence classes we assumed).
Further reading
Craig and Jaskiel Systematic Software Testing Chapter 5: Analysis and Design, section Equivalence partitioning Search web pages for more information and interesting examples (e.g. http://www.kaner.com/pdfs/ has many interesting articles and slides, such as What is a good test case?). There is a lot of relevant and interesting information on the web and it is up to you to find out and explore. I have provided the initial links from which this information can be accessed, but you must do all the legwork (remember the first lecture and the mountain guide?)
Next lecture