For fun lets make it a Animal class.
So the Animal class has this interface:
Code: Select all
walkForwards()
walkBackwards()
makeNoise()Code: Select all
walkSpeed
canWalkBackwards
noiseStyle
Code: Select all
A) walkForwards WILL walk the appropriate speed
B) walkBackwards WILL walk the appropriate speed
C) walkBackwards WILL throw an exception if this animal can not Walk Backwards
D) makeNoise should use the right noise styleCode: Select all
AnimalWalkTest test class will test paths A & B & C
AnimcalNoiseTest will test path DSo there is a new path
Code: Select all
E) walkForwards WILL throw an exception if animal is NOT a WalkerCode: Select all
AnimalWalkTest test class will test paths A & B
AnimcalCanWalkTest will test paths C & D & E
AnimcalNoiseTest will test path DI guess this would be more of a functional test suite, so I want to be able to test each possible path, lets say I needed to test all these paths. How do you organize the tests?
Code: Select all
walkSpeed = happy path
canWalkBackwards = True
noiseStyle = happy path
canWalk = True
walkSpeed = boundary path
canWalkBackwards = True
noiseStyle = happy path
canWalk = True
walkSpeed = happy path
canWalkBackwards = False
noiseStyle = happy path
canWalk = True
walkSpeed = happy path
canWalkBackwards = True
noiseStyle = boundary path
canWalk = True
walkSpeed = boundary path
canWalkBackwards = True
noiseStyle = boundary path
canWalk = True
walkSpeed = boundary path
canWalkBackwards = False
noiseStyle = boundary path
canWalk = True
walkSpeed = happy path
canWalkBackwards = True
noiseStyle = happy path
canWalk = False
walkSpeed = boundary path
canWalkBackwards = True
noiseStyle = happy path
canWalk = False
walkSpeed = happy path
canWalkBackwards = False
noiseStyle = happy path
canWalk = False
walkSpeed = happy path
canWalkBackwards = True
noiseStyle = boundary path
canWalk = False
walkSpeed = boundary path
canWalkBackwards = True
noiseStyle = boundary path
canWalk = False
walkSpeed = boundary path
canWalkBackwards = False
noiseStyle = boundary path
canWalk = FalseWould you have
Code: Select all
AnimalWalkForwardsNoiseTestClass
AnimalWalkForwardsSpeedTestClass
AnimalWalkBackwardsNoiseTestClass
AnimalWalkSpeedNoiseTestClassHow do you keep from littering your namespace?