0
0
JUnittesting~5 mins

JaCoCo setup and configuration in JUnit - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Acompile
Bpackage
Ctest
Dinstall
Which of these is NOT a report format generated by JaCoCo?
AHTML
BXML
CCSV
DPDF
How do you add JaCoCo to a Gradle project?
AApply the 'jacoco' plugin in build.gradle
BAdd JaCoCo dependency in dependencies block
CInclude JaCoCo jar in src folder
DRun JaCoCo as a separate command line tool
What does JaCoCo instrument in your project?
ATest classes only
BSource code classes
CBuild scripts
DDocumentation files
Which Maven plugin goal generates the JaCoCo coverage report?
Ajacoco:report
Bjacoco:clean
Cjacoco:check
Djacoco:prepare-agent
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.