Overreferencing
Definition:
It is about test-methods referencing many times classes from the application code. The main problem with an Overreferencing Test is that it causes a lot of unnecessary dependencies towards the model code. That distracts from the goal of the test.
Test creating unnecessary dependencies and causing duplication
Code Example:
BooleanTypesTest >> #testTrueFalseSubtype
| system boolType boolMetaType |
system := TPStructuralTypeSystem new.
boolType := TPClassType on: Boolean.
self assert: (system is: (TPClassType on: True) subtypeOf: boolType).
self assert: (system is: (TPClassType on: False) subtypeOf: boolType).
self assert: (system is: (TPClassType on: False) subtypeOf: (TPClassType on: True)).
self assert: (system is: (TPClassType on: True) subtypeOf: (TPClassType on: False)).
boolMetaType := TPClassType on: Boolean class.
self assert: (system is: (TPClassType on: True class) subtypeOf: boolMetaType).
self assert: (system is: (TPClassType on: False class) subtypeOf: boolMetaType).
self assert: (system is: (TPClassType on: False class) subtypeOf: (TPClassType on: True class)).
self assert: (system is: (TPClassType on: True class) subtypeOf: (TPClassType on: False class)).
References:
Quality attributes
- Code Example
- Cause and Effect
- Frequency
- Refactoring