Code coverage MythBusters
summary
Claim: aiming for 100% coverage isn't required — examples show JaCoCo, IntelliJ and SonarQube report different line/branch/instruction counts; mutation testing (PIT) finds surviving mutants even when line coverage is 100%. Tools actually used: JaCoCo, JUnit 4/5 (Vintage), Mockito, SonarQube, IntelliJ, Eclipse, JMH benchmark, PIT; surprising findings: zero coverage can reveal a wrong test engine, mocks can hide execution, compiler/JDK versions change branch counts, instrumentation slows tests and can break synchronization on some bytecode. Recommendation: treat coverage as a developer metric and use coverage to debug, not to appease managers.
AI-written summary · about
chapters (22)
- 0:00Introduction and setup
- 1:54Code coverage MythBusters concept
- 3:23Myth: 100% coverage is mandatory
- 5:57Debugging with zero coverage
- 7:00Coverage for debugging Eclipse
- 9:29Mocking and coverage limitations
- 12:40Coverage with Mockito issues
- 14:30Switch expressions and coverage
- 16:56Testing geometric shapes
- 18:18Coverage differences by JDK version
- 20:27Alternative coverage tools
- 21:52SonarQube coverage comparison
- 23:39Line vs instruction vs branch coverage
- 25:46Mutation testing with PIT
- 28:39100% coverage doesn't guarantee quality
- 29:46SonarQube project coverage issues
- 31:30Coverage for managers vs developers
- 32:11Observer effect on coverage measurement
- 34:18Performance impact of coverage tools
- 36:08Coverage affecting synchronization
- 38:44Summary and key takeaways
- 42:40Q&A session
