Equivalence Class Testing
Black Box testing method that partition possible input domain by expected output equivalence classes.
Test ≥ 1 set of inputs for each equivalence class:
- Assumption If the code works for the set of input(s), it should work for all other inputs in the same equivalence class.
Equivalence Classes
Equivalence Classes are sets of possible inputs with same expected output:
- Valid (Testing by Contract) Test successful / happy path for valid inputs eg. Login successful.
- Multiple Valid Values test multiple valid input values for each test case.
- Exhaustive Optionally, if the valid input domain is small all valid inputs can be tested.
- Invalid Test unsuccessful path for invalid inputs eg. Bad login credentials.
- Single Invalid Value test only 1 single input value (rest are valid inputs) for each test case to check code correctly rejects even with only 1 invalid input.
- Defensive Testing testing both Valid + Invalid inputs.
- Exception error case. eg. Unable to connect to Database.
Numeric Equivalence Classes are Contiguous\ Q: Suppose you have Invalid output for input range and .\ What are the Equivalence Classes?
A: 2 Equivalence classes since the input ranges are non overlapping:
- Invalid
- Invalid
Does not apply to discrete test inputs since they have no notion of "ranges".
Boundary Value Testing
Black Box Testing Heuristic to select test input values for numeric input range : test around boundary values & :
- Just Above
- At Boundary
- Just Below
Remove Duplicates Suppose selected test inputs overlaps with the test inputs of another case. Remove the duplication, since it redundant to verify twice with exactly the inputs.