volume_mute
Weather Station Object - Unit Testing
publish date: 2026/06/17 05:25:30.326835 UTC
volume_mute
Consider a WeatherStation object with a single constant attribute (identifier) and methods including reportWeather(), reportStatus(), powerSave(), remoteControl(), reconfigure(), restart(), and shutdown().
Why must the restart() method be executed before testing the shutdown() method?
Correct Answer
Because shutdown() has a dependency on the running state established by restart()
Explanation
Some test sequences are necessary because of state dependencies. To test the shutdown() method that shuts down instruments, the restart() method must have been executed first to place the object in a running state. This illustrates that methods sometimes cannot be tested in complete isolation.
Reference
Software Engineering, Ian Sommerville, 10th edition
