Recall & Review
beginner
What is JaCoCo used for in software testing?
JaCoCo is a tool that measures how much of your code is tested by your unit tests. It helps you see which parts of your code are covered and which are not.
Click to reveal answer
beginner
How do you add JaCoCo to a Maven project?
You add the JaCoCo plugin in your
pom.xml under build > plugins. This plugin runs during the test phase and generates coverage reports.Click to reveal answer
intermediate
What is the purpose of the
jacoco-maven-plugin in the build process?The
jacoco-maven-plugin instruments the code during tests to collect coverage data and then generates reports showing which code was executed.Click to reveal answer
beginner
Which JaCoCo report formats are commonly used?
JaCoCo can generate reports in HTML (for easy viewing in browsers), XML (for integration with other tools), and CSV formats.
Click to reveal answer
intermediate
How can you configure JaCoCo to fail the build if coverage is below a threshold?
In the JaCoCo plugin configuration, you can set rules with
check goals specifying minimum coverage percentages. If coverage is below these, the build fails.Click to reveal answer
What phase of the Maven build lifecycle does JaCoCo typically run in?
✗ Incorrect
JaCoCo runs during the test phase to collect coverage data while tests are executed.
Which of these is NOT a report format generated by JaCoCo?
✗ Incorrect
JaCoCo does not generate PDF reports by default; it supports HTML, XML, and CSV.
How do you add JaCoCo to a Gradle project?
✗ Incorrect
In Gradle, you apply the 'jacoco' plugin in your build.gradle file to enable coverage.
What does JaCoCo instrument in your project?
✗ Incorrect
JaCoCo instruments the source code classes to track which parts are executed during tests.
Which Maven plugin goal generates the JaCoCo coverage report?
✗ Incorrect
The 'jacoco:report' goal generates the coverage report after tests run.
Explain how to set up JaCoCo in a Maven project to generate coverage reports.
Think about where in the build file and lifecycle JaCoCo fits.
You got /4 concepts.
Describe how JaCoCo helps improve code quality in testing.
Consider how coverage data influences testing decisions.
You got /4 concepts.