0
0
JUnittesting~5 mins

Coverage reports in JUnit - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a coverage report in software testing?
A coverage report shows which parts of the code were tested by automated tests and which parts were not. It helps find untested code.
Click to reveal answer
beginner
Name two common types of code coverage measured in reports.
Line coverage (which lines ran) and branch coverage (which decision paths ran). Both help understand test completeness.
Click to reveal answer
intermediate
How does JUnit integrate with coverage tools to generate reports?
JUnit runs tests, and coverage tools like JaCoCo hook into the test run to track which code executes, then create reports after tests finish.
Click to reveal answer
intermediate
Why is 100% code coverage not always the goal?
Because some code is hard to test or not critical. Coverage shows tested code but not test quality or bugs. Aim for meaningful coverage.
Click to reveal answer
advanced
What does branch coverage tell you that line coverage might miss?
Branch coverage shows if all possible paths (like if-else branches) were tested, not just if lines ran. It finds missed decision cases.
Click to reveal answer
What does a coverage report primarily measure?
AMemory usage during tests
BHow fast the tests run
CNumber of tests written
DWhich code lines were executed during tests
Which tool commonly works with JUnit to generate coverage reports?
APostman
BSelenium
CJaCoCo
DJenkins
What does branch coverage help identify?
ALines with syntax errors
BUntested decision paths in code
CTest execution time
DNumber of test failures
Why might 100% coverage not guarantee bug-free code?
ACoverage shows tested code but not test quality
BCoverage tools only work on weekends
CTests never run on all machines
DCoverage measures only performance
Which coverage type measures if every line of code was executed?
ALine coverage
BBranch coverage
CPath coverage
DMutation coverage
Explain what a coverage report is and why it is useful in testing.
Think about how you check if you tested all parts of your code.
You got /3 concepts.
    Describe the difference between line coverage and branch coverage.
    Consider if statements and their possible outcomes.
    You got /3 concepts.