Sort each claim by whether a coverage report can actually support it.
Groups: Coverage can tell you this · Coverage cannot tell you this
- That every edge case of the tested code was exercised
- That the results produced by the tested lines were checked
- What fraction of branches were taken at least once
- Which lines never ran during the test suite
- That the program is correct
- That there is code in the program nobody has verified
Hints
- Coverage is a record of which code was EXECUTED, and nothing more.
- Ask whether each claim could be established by watching the code run with the assertions removed.
Show the answer
Coverage can tell you this: Which lines never ran during the test suite, What fraction of branches were taken at least once, That there is code in the program nobody has verified
Coverage cannot tell you this: That the results produced by the tested lines were checked, That every edge case of the tested code was exercised, That the program is correct
A coverage tool observes execution, so it can report untouched lines and branch percentages, and untouched code is genuinely unverified. It cannot see whether any result was compared against an expectation, so it cannot speak to edge cases or correctness. This is why coverage is a floor, not a guarantee.
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
- 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?
- A test suite can execute every line of a function and still miss the input that breaks it.