Software Development and Project Management
The specification says 'issue a warning if the temperature is 85 °C or higher', but the firmware mistakenly contains 'if (t > 85)'. The temperature t is an integer. Which of the following test values can detect this error?
- A84 °C
- B85 °C
- C86 °C
Show answer and explanation
Answer: B. 85 °C
According to the specification a warning should be issued at 85 °C, but t > 85 is false when t = 85, so the specification and the implementation disagree only when 85 °C is given. At 84 °C neither issues a warning and at 86 °C both do, so the error is not visible. Testing values that include the boundary itself in this way is the idea of boundary value analysis. Confusing comparison operators is a common error in threshold checks in firmware.
- A. Neither the specification nor the implementation issues a warning, so the results match and the error is not visible.
- B. Correct. The specification issues a warning and the implementation does not, so the error is detected.
- C. Both the specification and the implementation issue a warning, so the results match and the error is not visible.
Continue: 9 more Software Development and Project Management questions