Practice question · True or false
A test suite can execute every line of a function and still miss the input that breaks it.
Hints
- Does running a line check what it produced?
- Think of
return a / bwith b never zero.
Show the answer
True
Why
True. Coverage records that a line ran, not that its result was asserted or that it ran with the value that fails. return a / b reports full coverage while never seeing b = 0. Coverage is a useful floor, uncovered code is certainly untested, and a worthless ceiling.
Practise Testing Larger Behaviours
The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.
More questions on Testing Larger Behaviours
- Sort each claim by whether a coverage report can actually support it.
- Every unit test in a project passes. Select every kind of defect that could still be present.
- Test-driven development requires the new test to FAIL before any code is written. Why is that step not a…
- A test suite runs in four hours and developers stop running it before pushing. What has the suite become?